lkh1986
- 96
- 0
Homework Statement
I just started my C++ courses and here is my question.
Homework Equations
The Attempt at a Solution
//This program states whether a given year is a leap year or a non-leap year.
#include <iostream.h>
#include <conio.h>
void main ()
{
int year, value;
char answer,y, n;
while (answer == y)
{
cout << "Please input a year: ";
value = year/4;
if (value==int)
cout << ""<< year << " is a leap year. There are 29 days in Feb " << year <<".";
else
cout << ""<< year << " is a non-leap year. There are 28 days in Feb " << year <<".";
}
cout << "Do you want to continue? Press 'y' if yes or 'n' if no.";
getch();
}
It seems that "if (value==int)" is illegal. Is there any other way I can put th expression statement so that the computer can print out whether a given year is a leap year or not?
Thanks.