Day Of Year Problem.. Constant Error Message

Hi, I've searched the web and read a good amount of the Class chapter in my programming book to write this code but I keep getting this error...

"error C2143: syntax error : missing '}' before 'constant'"
"error C2143: syntax error : missing ';' before 'constant'"

I thought I'm missing a include instruction but I'm not sure :/
Thanks for helping!!!

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
//Day of the Year programming assignment
//by: Andrew A.

#include <iostream>
#include <string>

using namespace std;

class DayOfYear
{
public:
	static const int monthdays [];
	static const string monthname [];
	void print (int);
};


	const int DayOfYear::monthdays [] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 365};
	const string DayOfYear::monthname [] = {"January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};


void DayOfYear::print (int Date)
{
	int month = 0;
	while (DayOfYear::monthdays [month] < Date)
		month = (month + 1) %12;

	cout << "The Date you entered reads " << DayOfYear::monthname[month] <<  " " << Date - DayOfYear::monthdays[month-1] << endl;
};



int main()
{
	DayOfYear DatePrint;

	int Date;
	cout << "Enter a Date..." << endl;
	cin >> Date;
	
	if (Date <= 0 || Date > 365)
	{
		cout << "Please enter 1 ~ 365" << endl;
	};

	DatePrint.print(Date);

	cin.ignore();
	cin.get();
	return 0;
};
missing a comma before 365
 
const int DayOfYear::monthdays [] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 365};
Hi,

 
const int DayOfYear::monthdays [] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 365};


you just missed one ',' just before last element.(334 , 365)

 
const int DayOfYear::monthdays [] = {31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365};


haha wow bad proofing on my part! thanks guys!!!!
Topic archived. No new replies allowed.