What is wrong with that piece of code.Why it doeasn't let me compile. It gives me that errors on Dev-C++ :

15 expected primary-expression before "void" 
15 ISO C++ forbids declaration of `privite' with no type 
15 expected `;' before "void" 
    In member function `void DayOfYear::input()': 
45  `check_date' undeclared (first use this function) 
     (Each undeclared identifier is reported only once for each function it appears in.) 
  At global scope: 
49 no `void DayOfYear::check_date()' member function declared in class `DayOfYear' 
    In member function `void DayOfYear::set(int, int)': 
67 `check_date' undeclared (first use this function) 


using namespace std;
class DayOfYear
             void input();
             void output();
             void set(int new_month, int new_day);
             int get_month();
             int get_day();
              void check_date();
              int month;
              int day;
int main()
 DayOfYear today,bach_birthday;

 cout<<"Enter todays date: ";
 cout<<"Todays date is :";
 if (today.get_month()==bach_birthday.get_month()&&today.get_day()==bach_birthday.get_day())
 cout<<"Happy birthday Bach ";
 cout<<"Happy unbirthday Bach";

 return 0;
void DayOfYear::input()
     cout<<"Enter the month as a number: ";
     cout<<"Enter the day of the month: ";
void DayOfYear::check_date()
     if ((month<1)||(month>12)||(day<1)||(day>31))
       cout<<"Illigal date. Aborting program.\n)";
void DayOfYear::output()
     cout<<"The month is: "<<month;
     cout<<"\nThe day is: "<<day;

void DayOfYear::set(int new_month,int new_day)
int DayOfYear::get_month()
    return month;
int DayOfYear::get_day()
    return day;

15 ISO C++ forbids declaration of `privite' with no type

The error says it all. private is misspelled.

When saw that error first thing I thought is misspelling, but check it yourself. Did you try to compile it? This can't be misspelling.

Did you try to compile it? This can't be misspelling.

I just did to be sure. I got the same errors and changing privite to private fixed everything.

o yeee. thats right, all the time i thought about the member function name. That explain everything. thanks a lot

Whenever you're trying to track a whole list of compiler errors, Always look to fix the first error in the list (usually found on the line of the first error, or the line just before the first error) , then try a recompile before fixing any more.

The reason behind this method, very often, just one small mistake can have a knock-on effect, producing a ton of other "phantom" error messages. (ie, error messages which aren't actually errors, and exist only as a result of the compiler being confused by the initial error).

Another tip - use the little-and-often approach to compiling.. ie, write a few lines, then try to compile.. This minimises the chance of getting a long list of errors, but also immediately narrows down the location of the errors when they occur - if everything was working fine on the previous compile, and all you've done is change 1 line of code, you can bet any money the error will be on that line.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.