Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Author Message
XeRoideR999

Posted: 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.
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"

Tony

Posted: 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
Tony's programming blog. DWITE - a programming contest.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 2 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: