Dear all,
I'm a beginner learning C++ and I'm using the book Jumping into C++ - which by the way is really good. I'm currently doing the exercises for the fifth chapter (Loops) and I've done all of them, but I wanted to go the extra mile on the last program I'm supposed to design. The program is a poll and all the input from the user will be with numbers. However when a letter is pressed then of course you get wrong behaviour from the program, it keeps looping endlessly.
Here is a fragment of what I think is the way of doing it - but of course it's not working
Code:
int p = 0
char anyLetter[]={"abcde"}; //Initializing char variable
char a = anyLetter[p];
else if (userAnswer[n] == a) //if statement where char needs to be used.
{
cout << "Pressing a letter maybe? It's only with numbers. Try again." << endl;
continue;
}
Any ideas? suggestions? Thanks guys