I'm taking a intro class in a c++ class and i have been skiping class because honestly it's the type of stuff that if you see some one do it you pretty much got it down... but i'm stuck since i haven't been in class in a whiel and we have a major preogram to built and i can't remember how to end a program if an invalid input is entered help?
7 Replies - 3301 Views - Last Post: 28 February 2011 - 10:47 PM
#1
How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:08 PM
Replies To: How to stop C++ program if an invalid input is entered?
#2
Re: How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:17 PM
eze123, on 28 February 2011 - 10:08 PM, said:
I'm taking a intro class in a c++ class and i have been skiping class because honestly it's the type of stuff that if you see some one do it you pretty much got it down... but i'm stuck since i haven't been in class in a whiel and we have a major preogram to built and i can't remember how to end a program if an invalid input is entered help?
So you skip class because the stuff is so easy that you seen it once and you have it down. Yet you don't know it, because you haven't been to class in awhile? You could probably use a while loop
#3
Re: How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:19 PM
#5
Re: How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:26 PM
LOL omg i know it... I just can't remember right now... I'm really tired if i slept by tomorrow morning i would remember.... SORRY for asking for help i just thought that that's what this forum was for...
#6
Re: How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:36 PM
Look at the example for assert in the link I posted. You have to form some logical expression that will evaluate to true if the input is valid and false otherwise. If false, assert fails and the program terminates.
#7
Re: How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:42 PM
Thank you I'm new to this site is there some kind of way i can boost your rep or what ever? and do i close this post?
#8
Re: How to stop C++ program if an invalid input is entered?
Posted 28 February 2011 - 10:47 PM
In the lower right corner? Click your appreciation ...
Assert is usually just a debug temporary way to handle bad data input ...
You might like to see ...
to see one simple way to test for/validate (numeric) input ...
Assert is usually just a debug temporary way to handle bad data input ...
You might like to see ...
http://developers-heaven.net/forum/index.php/topic,2019.0.html
to see one simple way to test for/validate (numeric) input ...
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|