Need help with homework
Stuck on an assignment with this code. I keep getting the following errors. can someone please point me in the right direction.
error C2236: unexpected 'class' 'invalidDay'. Did you forget a ';'?
error C2447: '{' : missing function header (old-style formal list?)
error C2065: '“Invalid' : undeclared identifier
error C2146: syntax error : missing ';' before identifier 'Date”'
error C2065: 'Date”' : undeclared identifier
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
#include "stdafx.h"
#include <iostream>
#include <ctime>
#include <string>
#include <sstream>
#include <conio.h>
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();
} void 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";
}
|
You seem to be missing the terminating semicolons for your classes, and main() must be defined to return an int:
1 2 3 4
|
int main()
{
return 0;
}
|
Hi,
Line 21, you have a semicolon; which is not the way classes work...
Topic archived. No new replies allowed.