I am doing a homework assignment where we have to have the user input a year and determine if it is a leap year or not. When i compile, I am have problems with "else" not being linked to "if". Am i writing a portion wrong, or what could it be. Any help is appreciated.
Code:#include <iostream> using namespace std; int main() { int entered_year, leap_year; cout << "Welcome to the Leap Year program." << endl; cout << endl; cout << "Please enter the year you wish to check if it is a leap year: "; cin >> entered_year; cout << endl; cout << "Please wait while we check if "; cout << entered_year; cout << " is a leap year..." << endl; { if ( entered_year % 4 == 0 ) cout << entered_year; cout << " is a leap year." << endl; { if ( entered_year % 100 == 0 ) cout << entered_year; cout << " is not a leap year."; { if ( entered_year % 400 == 0) cout << entered_year; cout << " is a leap year."; else cout << entered_year; cout << " is not a leap year." << endl; } else cout << entered_year; cout << "is a leap year." << endl; } else cout << entered_year; cout << " is not a leap year." << endl; } return 0; }