Lazarus
Free Pascal => Beginners => Topic started by: godik on October 10, 2018, 05:15:51 pm
Title:
Calculating Volume and surface of the ball using Program
Post by:
godik
on
October 10, 2018, 05:15:51 pm
Hello Can Someone help me how can I do this? and when i want to make this program i have to use Button,Tedit,Tlabel.Thank you all.
Title:
Re: Calculating Volume and surface of the ball using Program
Post by:
Blaazen
on
October 10, 2018, 05:34:53 pm
Code: Pascal
[Select]
[+]
[-]
uses
math
;
...
volume
:
=
4
*
pi
*
power
(
r
,
3
)
/
3
;
surface
:
=
4
*
pi
*
r
*
r
;
Title:
Re: Calculating Volume and surface of the ball using Program
Post by:
godik
on
October 10, 2018, 05:45:30 pm
But I have to use button,tedit and tlabel
Title:
Re: Calculating Volume and surface of the ball using Program
Post by:
Blaazen
on
October 10, 2018, 05:51:03 pm
I guess user will fill the radius of the ball to the edit. You have to convert it from string to integer with r:=strtoint(Edit1.Text);
You can do it in event Button1.OnClick, together with the formulas above. And result write to the label, using Label1.Caption:=inttostr(Volume);
Just try yourself or show us what you already have.
Title:
Re: Calculating Volume and surface of the ball using Program
Post by:
Handoko
on
October 10, 2018, 05:51:35 pm
@godik
It sounds like a homework.
Have you wrote something? Show us your code. If none, you should try to do it your best first then post your code here, so others can guide you.
Title:
Re: Calculating Volume and surface of the ball using Program
Post by:
Soner
on
October 10, 2018, 09:10:04 pm
Look here:
http://wiki.freepascal.org/Form_Tutorial (http://wiki.freepascal.org/Form_Tutorial)
Title:
Re: Calculating Volume and surface of the ball using Program
Post by:
Bart
on
October 12, 2018, 03:02:54 pm
Use a TFloatSpinEdit, no need to convert to and from string, it has a Value property.
Bart
TinyPortal
© 2005-2018