For an assignment in my C++ class, I need to create a program which will determine if a year entered is a leap year using the while lop to input multiple years successively. I've written out what I believe is an appropriate program, but when I try to run it, and I enter a value, the while loop seems not to do anything. Can anyone point out where I went wrong with this?
int main()
{
ofstream output ("c:result0.dat");
int year;
cout<<"Enter a year: "<<endl;
output<<"Enter a year: "<<endl;
cin>>year;
while(year>0);
if(((year%400==0)||(year%100!=0)&&(year%4==0)))
{
cout<<year<<" is a leap year."<<endl;
output<<year<<" is a leap year."<<endl;
}
else
{
cout<<year<<" is not a leap year."<<endl;
output<<year<<" is not a leap year."<<endl;
}
return 0;
}