This is what the code looks like. It's a simple program to determine which years are leap years, and which aren't. I'm having trouble ending the program if the user types ctrl-z. Any help would be appreciated. I know it's probably something simple, but I can't figure it out. :(
Here's the code:
#include <iostream>
using namespace std;
bool isLeap(int year);
int main(){
int year;
bool leapYear;
do{
cout << "Enter a year: ";
cin >> year;
leapYear = isLeap(year);
if (leapYear == true)
cout << year << " is a Leap Year. \n\n";
else
cout << year << " is not a Leap Year. \n\n";
}while(year != EOF);
return 0;
}
bool isLeap(int year){
bool trueOrFalse;
double condition1;
double condition2;
double condition3;
condition1 = (year % 4);
condition2 = (year % 100);
condition3 = (year % 400);
if(condition1 == 0 && condition2 != 0 || condition3 == 0)
trueOrFalse = true;
else
trueOrFalse = false;
return(trueOrFalse);