showing decimal place on tlabel->desperate!!

hi to all of the experts here, i am at my wits end.
this is a very simple operation which i somehow could not solve
basically i would need to tabulate the answer and display the answer on either Tlabel or Tedit

float Prob;


Prob=30/25;
Label56->Caption=Prob;

can anyone help and enlighten me?'
the current output is 1 when it should have been 1.2
Last edited on
Caption is probably an int, or cout is at setpercision(0).
Hi so how can i solve this problem?

Label is in STR

30/25 is 1 - because written like that both numbers will be taken as intergers which will be converted to float (1.000).

You need to write 30.0 /25 or 30/25.0 or 30.0/25.0 then Prob
will be 1.2.

if Label56->Caption=Prob; is still 1, then it is probably being truncating back to integer by the TLabel.

What is Tlabel ? (sounds like a Borland / Delphi style component to me or c++ builder?)
Topic archived. No new replies allowed.