Help with my program please
Author |
Message |
xgoldx
|
Posted: Sat Nov 19, 2005 3:07 pm Post subject: Help with my program please |
|
|
Hi, i attempted to write a program that :
prompts the user for their full name and year of birth. the output of the pgoram will be the user's age and its equivalent in seconds.
but, my program gives me a weird answear in end, can some one please help me fix it? thanks
var name : string
var second,hour,day,year,years : int
var seconds : real
second:=60
hour:=60
day:=24
year:=365
put "please enter in your name"
get name
put "hi, ", name, " can you please enter the year of your birth"
get years
seconds:= second*hour*day*year*(2005-years)
put "you have been living for ", seconds |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Cervantes
|
Posted: Sat Nov 19, 2005 3:54 pm Post subject: (No subject) |
|
|
It doesn't give you a wierd answer. It gives you an answer in scientific notation.
3.00e8 = 3.00 * 10^8
To output in standard numbers, use frealstr.
code: |
frealstr (seconds, 0, 0) |
And don't post meaningless subject titles. Read. |
|
|
|
|
|
|
|