How do I get this code right? Im using Lazerus which is Delphi based. Cant get it to multiply text fields and then divide by value.
-
The code I'm trying to use is: procedure TForm1.Label1Click(Sender: TObject); begin Cube1.caption := [(Width1.Text)*(Length1.Text)*(Height1.Text)]/1728; end; Just wanting to multiply three text fields that were entered by user then divide that sum by 1728. Thanks,
-
Answer:
You could have some problems if you are assigning a real value to an integer variable. The result of a "/" division is always a float (double, extended ...). "You are assigning a real value to an integer variable. Change "i: integer" to "i: double" and you are fine." "/ is a floating point division div is an integer division" Source and further information: http://forum.lazarus.freepascal.org/index.php?topic=18942.0
Elijul at Answerbag.com Visit the source
Other answers
I'm Trying this now but cant figure out where to put the / 1728. I can get it to multiply the three strings now just not divide, plz help: procedure TForm1.Cal1Click(Sender: TObject); var W: integer; L: integer; H: integer; begin W := StrToIntDef(Width1.Text, 0); L := StrToIntDef(Length1.Text, 0); H := StrToIntDef(Height1.Text, 0); Cube1.caption := IntToStr(W*L*H); end;
Elijul
Related Q & A:
- How can I get custom fields in wordpress?Best solution by Stack Overflow
- How do I get mail in my in-box without the right address or right name?Best solution by Yahoo! Answers
- How do I get the code for my radio in my Renault Clio?Best solution by Yahoo! Answers
- How do I get the code for the Jumbo remote?Best solution by jumboremotecontrol.com
- How can I get cash on ebay by using a paypal?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.