Leap year error!! plzz help!

// Enter a number and this indicates if it is a leap year
#include <iostream>
using namespace std;

int main ()
{
//loop answer
char ans;
//loop itself
do
{
//variable
int leap_year;
//intro
cout << "Hi.\n" << endl;
cout << "To determine if a your number is a leap year,\n" << endl;
cout << "Enter your number in question: \n" << endl;
cin >> leap_year;
cout << "\n" << endl;

//if number divisible by 4 leap year
// number divisible by 100 not leap year
//if number divisible by 400 leap year.

if ( ( leap_year % 4 == 0 && leap_year % 100 != 0 ) || ( leap_year % 400 == 0 ) );
{
cout << leap_year << " is a Leap Year! \n" << endl;
}
else
{
cout << leap_year << " is not a Leap Year. \n" << endl;
}
}
while ( ( ans == 'Y' ) || ( ans == 'y' ) );
{
cout << "End of Program!!! \n" << endl;
cout << "Good-Bye. \n" << endl;
}
}

everything compiles but codeblocks keeps telling me i have an error . it says i have an "else" without an "if" i dont understand why really... its not supposed to if my "if" is right above it ?????
sorry on my page its spaced out cleaner ..
Remove the semicolon at the end of
if ( ( leap_year % 4 == 0 && leap_year % 100 != 0 ) || ( leap_year % 400 == 0 ) );
Last edited on
if ( ( leap_year % 4 == 0 && leap_year % 100 != 0 ) || ( leap_year % 400 == 0 ) );


You don't want a semi-colon at the end.
Wow!!!!! lol thank you soo much.. what a simple error! :D
Topic archived. No new replies allowed.