I can not figure out the problem with my program. I am extremely knew at this. The error I get is at the last ' } ' of the program it says "Error expected declaration before '}' token" please help?
This is my code
#include <iostream> //Header Files
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
int main()
{
bool leapYear( int year);
int DIW(int year);
int DOW, year, month, day = 0;
int FDOM;
int mDays[]={ 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
int i = 0;
cout<<"Enter a year"<<endl;
cin>>year;
if( leapYear( year ) == true )
mDays[ 2 ] = 29;
DOW = DIW( year );
cout<<"Please enter the day of January 1st"<<endl;
cin>>day;
bool leapYear(int year);
{
if (year % 4 ==0)
return true;
else
return false;
}
// Print this year's calendar
for (int month = 0; month < 12; ++month)
cout << setw(3) << " ";
if (month == 0)
cout << "January \n";
if (month == 1)
cout << "February \n";
if (month == 2)
cout << "March \n";
if (month == 3)
cout << "April \n";
if (month == 4)
cout << "May \n";
if (month ==5)
cout << "June \n";
if (month == 6)
cout << "July \n";
if (month == 7)
cout << "August \n";
if (month == 8)
cout << "September \n";
if (month == 9)
cout << "October \n";
if (month == 10)
cout << "November \n";
if (month == 11)
cout << "December \n";
cout << " S M T W T F S \n" << endl;
//Determine where the first day begins
day = 0;
for (FDOM; FDOM < day; ++FDOM)
cout << setw(3);
// Print this month's calendar
for (int mDay = 0; mDay < mDays[month]; ++mDay){
cout << setw(3) << mDay + 1;
DOW++;}
if (DOW == 7) {
cout << "\n" << setw(3);
DOW = 0;}
if (DOW != 7) {
cout << "\n";
cout << endl;
day = DOW + 1;}
return 0;
}
}