@MikeyBoy Ah, I see. The 0, right? So, if I want the loop to run infinitely times until user enters b (or something other than a), what do I do? (Sorry, I am new at c++!)
When I deleted the 0, the program still doesnt run
Eyenrique-MacBook-Pro:Desktop Eyenrique$ ./LoopEOF
Enter number(ctrl+z to exit): 1
1 is odd
Enter number(ctrl+z to quit): 2
2 is even.
Enter number(ctrl+z to quit): 3
3 is odd
Enter number(ctrl+z to quit): 4
4 is even.
Enter number(ctrl+z to quit): 5
5 is odd
Enter number(ctrl+z to quit): ^Z <-- EOF command (ctrl+z Mac OS X)
//LoopEOF.cpp
//##
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
bool isEven(int number);
int main(){
int number;
cout<<"Enter number(ctrl+z to exit): ";
cin>>number;
while(!cin.eof()){//while end-of-file character or sequence is NOT entered
if(isEven(number))
cout<<number<<" is even."<<endl;
else{
cout<<number<<" is odd"<<endl;
}//end if-else
cout<<"Enter number(ctrl+z to quit): ";
cin>>number;
}//end while
return 0; //indicates success
}//end of main
bool isEven(int number){
if(number%2==0)returntrue;
returnfalse;
}//end function isEven