cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
output running nonstop
output running nonstop
Dec 28, 2011 at 9:14am UTC
newlearner
(11)
When my program prompt the user to enter numbers it will perform the calculation.
but when user enter it with characters (e.g a or b) the output will run nonstop....is there any way to stop this from happening?
Dec 28, 2011 at 9:33am UTC
hamsterman
(4538)
See
http://cplusplus.com/articles/S3wTURfi/
Dec 28, 2011 at 10:01am UTC
newlearner
(11)
im using the cin to get the input....how im gonna do that?
Dec 28, 2011 at 10:31am UTC
hamsterman
(4538)
Did you read the article at all? It gives you the code to validate your input. That's exactly want you need..
Dec 28, 2011 at 3:00pm UTC
eypros
(329)
I would also suggest that you can read your input as string, check if it's number and then convert it to one, but I think that the proposed article is better solution (and more c++-styled)
Topic archived. No new replies allowed.