Example Output 1 (not a leap year, input is in bolded italics):
Enter a year: <b>1800</b>
Is the year evenly divisible by 4? Yes.
Is the year evenly divisible by 100? Yes.
Is the year evenly divisible by 400? No.
1800 is not a leap year.
Example Output 2 (is a leap year, input is in bolded italics):
Enter a year: <b>2364</b>
Is the year evenly divisible by 4? Yes.
Is the year evenly divisible by 100? No.
Is the year evenly divisible by 400? No.
2104 is a leap year.
i have to create three Boolean variables for this but i'm confused on how to do so. This is what i have so far but i don't feel like i'm on the right track.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <iostream>
#include <string>
using namespace std;
int main ()
{
int year;
cout << "Enter a year: ";
cin >> year;
cout << endl;
if (leap_year(year) == true)
{
cout << "Is the year evenly divisible by 4? Yes."
}
if (leap_year(year) == false)
{
cout << "Is the year evenly"
}
return 0;
}
|