vendredi 4 décembre 2015

C++ Integer Input only - Streamsize max error?

I have attempted to use the limits streamsize function but I have had issues with it. For example for whatever reason "max" returns an error and says it is undefined (I have included everything).

Also if I type for example an alphanumerical character and an integer at once it returns correct and false at the same time so it prints correct and moves on with the program.

All I need to do is make sure they dont enter alphanumerical characters into the console as it is an answer to an integer related math question.

I current have these variables:

int answer // The answer of the generated question
int userAnswer // The users answer to the question... This is what I need to make sure that they answer an int for.




Aucun commentaire:

Enregistrer un commentaire