I'm experiencing problems with this code, when running it the default runs also being that at no time did I enter any data other than what is in the cases.
// faz loop até usuário digitar a sequência de teclas de fim do arquivo
while ((grade = cin.get()) != EOF)
{
// determina a nota que foi inserida
switch (grade)
{
case 'A':
case 'a':
aCount++;
break;
case 'B':
case 'b':
bCount++;
break;
case 'C':
case 'c':
cCount++;
break;
case 'D':
case 'd':
dCount++;
break;
case 'F':
case 'f':
fCount++;
break;
default:
cout << "Incorrect letter grade entered." << " Enter a new grade." << endl;
} // fim do switch
} // fim do while
Can anyone tell me what's happening, does it have to be with the buffer of the keyboard that gets the \n
when I enter the data? How do I resolve this?