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

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




PostPosted: Tue Jan 18, 2011 12:21 pm   Post subject: Error Correction Help

Hiya, im creating a game that involve the users to input numbers. the problem is that when an incorrect character is inputed like a letter or a dash by accident. the game frezes and we have to restart. is there a way to make the game correct the mistake or simply ask the user for the right input if the input was an illegal character? i dont whan them to restart the whole game, but just that section or soemthing. PLEASE HELP and be detail. also can u give me an example too.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Tue Jan 18, 2011 12:56 pm   Post subject: RE:Error Correction Help

As the user for a string, then use strintok and strint to either convert it to an int or prompt the user to enter a new value.
Krocker




PostPosted: Tue Jan 18, 2011 5:07 pm   Post subject: RE:Error Correction Help

im new at this, so i did not understand wat u said. can u show me an example?
2goto1




PostPosted: Tue Jan 18, 2011 5:11 pm   Post subject: RE:Error Correction Help

Try posting your code that you've created so far. It will be easier for people to help you out.
Krocker




PostPosted: Tue Jan 18, 2011 5:15 pm   Post subject: RE:Error Correction Help

the problem is that i dont want ppl to copy the codes so ya
Tony




PostPosted: Tue Jan 18, 2011 5:17 pm   Post subject: RE:Error Correction Help

here -- strintok
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Krocker




PostPosted: Tue Jan 18, 2011 5:45 pm   Post subject: RE:Error Correction Help

ok.. but how would i put that into my game?
Tony




PostPosted: Tue Jan 18, 2011 6:00 pm   Post subject: Re: RE:Error Correction Help

Krocker @ Tue Jan 18, 2011 5:45 pm wrote:
ok.. but how would i put that into my game?

Insectoid @ Tue Jan 18, 2011 12:56 pm wrote:
As the user for a string, then use strintok and strint to either convert it to an int or prompt the user to enter a new value.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Krocker




PostPosted: Tue Jan 18, 2011 6:20 pm   Post subject: RE:Error Correction Help

u guys ar bot understanding, im not sure how to use the code. how am i suposed to input the code into my game? what am i supposed to write?
Tony




PostPosted: Tue Jan 18, 2011 6:32 pm   Post subject: RE:Error Correction Help

I'm not sure what else to tell you. The link to documentation has been posted; and it's been said how it could be applied.

Perhaps you can experiment with different values, to see how the function behaves.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
TokenHerbz




PostPosted: Tue Jan 18, 2011 6:41 pm   Post subject: RE:Error Correction Help

if strintok (string var) = true then
%%THIS IS AN INT VALUE
else %%ITS FALSE
%%THIS MEANS ITS GOT STRINGS IN IT!
end if

str int ok --string TO INT OK(GOOD?) YES/NO (booleans)

now you know how to use it.
Krocker




PostPosted: Tue Jan 18, 2011 6:47 pm   Post subject: RE:Error Correction Help

thats what i needed thx alot!!!!!!1
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  [ 12 Posts ]
Jump to:   


Style:  
Search: