Im doing a course in at the minute and have to write a game (rock paper scissors) in c++ using a console, but im having a small problem.
Basically i want to limit the ammount of characters that can be entered
cout <<"Please enter your selection : "<<endl<<endl;
cout <<"1 = Rock"<<endl;
cout <<"2 = Paper"<<endl;
cout <<"3 = Scissors"<<endl<<endl;
Is as far as i've got at the minute. I i know i can limit the stored value by setting input as an array, but it will still allow more than one character to be entered in the console, it just doesnt store the rest.
I know stopping someone from typing more than one character is more than likely out of the question, but i'd be more than happy to be able to display an error message if more than one character was entered. Can the characters entered be counted?
Anyone got any sugestions at all?