Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with my program please
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xgoldx




PostPosted: 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
Sponsor
sponsor
Cervantes




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: