Topic: Sine of angle
What is wrong?
Edit2 is angle, edit1 should be sinus of this angle.
procedure Form1_Edit2_OnChange (Sender: TObject);
begin
form1.edit1.value := SIN(form1.edit2.value*PI/180 ) ;
end;
My Visual Database → Script → Sine of angle
What is wrong?
Edit2 is angle, edit1 should be sinus of this angle.
procedure Form1_Edit2_OnChange (Sender: TObject);
begin
form1.edit1.value := SIN(form1.edit2.value*PI/180 ) ;
end;
Hello markOS
Can this help you ?
A simple example of code that needs the MATH unit:
: Enter degrees, minutes and seconds of an angle in 3 edit boxes, and display the sine and the cosine of the angle. Of course, in real life you have to do some error checking on what is entered into the TEdit boxes.
: procedure TForm1.btnCalculateClick(Sender: TObject);
: var
: Deg, Min, Sec: integer;
: D, R, S, C: real;
: begin
: Deg := StrToInt(editDeg.Text);
: Min := StrToInt(editMin.Text);
: Sec := StrToInt(editSec.Text);
: D := Deg + Min / 60 + Sec / 3600; // degrees plus decimal fraction
: R := DegToRad(D); // convert degrees to radians
: S := Sin(R);
: C := Cos(R);
: labelDegDec.Caption := FloatToStr(D);
: labelRad.Caption := FloatToStr(R);
: labelSin.Caption := FloatToStr(S);
: labelCos.Caption := FloatToStr(C);
: end;
JB
Try it.
Thanks , NX,
It is simple and correct.
MarkoS
My Visual Database → Script → Sine of angle
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi