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

Username:   Password: 
 RegisterRegister   
 Error!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tlivingston




PostPosted: Fri Dec 06, 2002 5:19 pm   Post subject: Error!

How can i make that when i ask a user to enter a number( such as a deposit for a bank) there won't be an error if they enter a word.

Obviously one could make it s string but the problem is i need to be able to use adding, subtracting, etc on these inputs (basically, how can i trun a string into an integer?).

Thanks a lot for your help, Ted.
Sponsor
Sponsor
Sponsor
sponsor
krishon




PostPosted: Fri Dec 06, 2002 5:26 pm   Post subject: (No subject)

ted, i think all u hafta do is like put in or int ( dun't remember which one it is) after the variable name. It is the same as turning a int into a string, u add str to the end of it. U could verify with someone else, but i think that's it
Tony




PostPosted: Fri Dec 06, 2002 5:31 pm   Post subject: (No subject)

you take input as String, then use

strint("text") to convert string to integer value.

such as

strint("10") returns integer value of 10
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
krishon




PostPosted: Fri Dec 06, 2002 11:35 pm   Post subject: (No subject)

that wuz wuz i meant, i just wusn't sure of the code, lol, so ted feelin betta or u still sick
tlivingston




PostPosted: Sat Dec 07, 2002 11:07 am   Post subject: (No subject)

feelin a bit better....hopefully in on monday if my voice isnt still shot
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  [ 5 Posts ]
Jump to:   


Style:  
Search: