Hi guys, I got stuck and I dont know what's wrong with this code. The isEven is a function created by me, but the thing is that the debbuger says the != opperator doesnt match.
cout << "Enter some integer to see if is even." << endl
<< "Enter the EOF character to end input." << endl;
int entero;
while((cin >> entero) != EOF)
{
cout << "\nThe number " << entero << " is " << isEven (entero);
}
Where is EOF decleard?
And if you want to compare a number to a string EOF you need to put it inside "EOF" like that and type cast from a int to a char\ string.
Chrevil, the second option works for what I want, however, I was looking at a code of Dietel C++ and he has the next code in the definition of a memeber function of a userdefined class.
void GradeBook::inputGrades()
{
int grade;
cout << "Enter the letter grades." << endl
<< "\nEnter the EOF character to end input";
while ( ( grade = cin.get() ) != EOF )
{
DO SOMETHING WHICH IS NOT IMPORTANT IN THIS CASE..
}
}
> but the thing is that the debbugercompiler says the != opperator doesnt match.
So you don't understand the message, fine. ¿why are you rephrasing it?