Leap Year determination while loop problem

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?

#include <fstream>
#include <iomanip>
#include <iostream>
#include <math.h>
#include <stdlib.h>

using namespace std;

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;
}
1
2
3
while(year>0);//<-- remove semicolon
{//all code that should run if the while condition is true in curly braces here
} 
Thank you. :)
One more thing: You should add break command after each statement, because now your program is running infinite time.
Topic archived. No new replies allowed.