You've already been told how to fix most of these errors:
Line 16: get rid of the {;
Line 20: This is a forward declaration of main(). It's not illegal, but it's not needed.
Line 22: Get rid of the ;
Line 31: Is this supposed to be a nested class? Get rid of the ;
Line 38: You need a }; to terminate the nested invalidDay class.
Line 38.1: You need a }; to terminate the invalidMonth class. If invalidDay is not intended to be a nested class, then this should be at line 30.
Line 39: main() must return type int.
Line 40: You need a { to open the code block for main()
Line 57: Wrong quote marks.
Line 87: Extraneous { Get rid of it.
Not clear what the purpose of your classes is. You don't use them.
Please do not open a new thread for the same problem:
http://www.cplusplus.com/forum/beginner/194928/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#include <iostream>
using namespace std;
class invalidMonth
{
public:
invalidMonth() throw();
invalidMonth(const exception&) throw();
invalidMonth& operator=(const exception&) throw();
};
class invalidDay
{
public:
invalidDay() throw();
invalidDay(const exception&) throw();
invalidDay& operator=(const exception&) throw();
};
int main()
{ int month, day, year;
cout << "Enter the month" << endl;
cin >> month;
cout << "Enter the day" << endl;
cin >> day;
cout << "Enter the year" << endl;
cin >> year;
cout << "The date is " << day << "-" << month << "-" << year << "." << endl;
if (day > 31)
cout << "Invalid Date";
if (month == 1)
cout << "January ";
else if (month == 2)
cout << "February ";
else if (month == 3)
cout << "March ";
else if (month == 4)
cout << "April ";
else if (month == 5)
cout << "May ";
else if (month == 6)
cout << "June ";
else if (month == 7)
cout << "July ";
else if (month == 8)
cout << "August ";
else if (month == 9)
cout << "September ";
else if (month == 10)
cout << "October ";
else if (month == 11)
cout << "November ";
else if (month == 12)
cout << "December ";
else
cout << "Invalid month";
return 0;
}
|