I am doing a simple code on identifying even and odd numbers in a text file using
Here is my code, the only error I supposedly get is the exclamation mark in the while loop
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int even = 0, odd = 0;
int value;
ifstream file3("evenodd.txt");
while (!file3.eof) {
file3 >> value;
if (value % 2 == 0) {
even++;
}
else {
odd++;
}
cout << " Even count: " << even << " ";
cout << "Odd count: " << odd << " ";
}
}