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

Username:   Password: 
 RegisterRegister   
 error trap help me please
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
XeRoideR999




PostPosted: Sun Jan 18, 2004 2:26 pm   Post subject: error trap help me please

ok guys, i got a question? how do i error trap my thing, its a converting minutes to hours and minutes.
when i type a whole number example: 122 its 2 hours and 2 minutes.
and when i type 2.4 or letters, i want it to repeat my question.
please help me with this, ijust need the code for it.
Quote:
procedure percent
(x1, y1, x2, y2, num : int)
drawfillbox (x1 - 2, y1 - 2, x2 + 2, y2 + 2, grey)
drawbox (x1 - 2, y1 - 2, x2 + 2, y2 + 2, black)
for i : 1 .. round ((x2 - x1) * num / 100) by 10
drawfillbox (x1 + i, y1, x1 + i + 7, y2, blue)
end for
end percent
put "Enter a number to be converted into hours and minutes."
put ""
put "NOTE: please enter a whole number, and not Decimals or Letters!!"
put ""
put "when you finish the typing press enter"
var minutes, minu2, newvar, newvar2 : int
get minutes
newvar := minutes div 60
newvar2 := minutes mod 60
cls
locate (8, 30)
color (1)
put "Converting..."
for i : 1 .. 100
locate (10, 34)
put i, "%"
percent (100, 100, 500, 110, i)
delay (50)
end for
cls
locate (7, 23)
put "Your Converted Number is Here"
locate (10, 25)
put newvar, "Hours and ", newvar2, " Minutes"
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Sun Jan 18, 2004 2:27 pm   Post subject: (No subject)

there's a tutorial on that... you accept input as string then use strintok() and strint() to convert to number
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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: