Hi
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)
code:
#include<iostream>
#include<conio.h>
using namespace std;
class DayOfYear
{
public:
void input();
void output();
void set(int new_month, int new_day);
int get_month();
int get_day();
privite:
void check_date();
int month;
int day;
};
int main()
{
DayOfYear today,bach_birthday;
cout<<"Enter todays date: ";
today.input();
cout<<"Todays date is :";
today.output();
bach_birthday.set(3,21);
if (today.get_month()==bach_birthday.get_month()&&today.get_day()==bach_birthday.get_day())
cout<<"Happy birthday Bach ";
else
cout<<"Happy unbirthday Bach";
getch();
return 0;
}
void DayOfYear::input()
{
cout<<"Enter the month as a number: ";
cin>>month;
cout<<"Enter the day of the month: ";
cin>>day;
check_date();
}
void DayOfYear::check_date()
{
if ((month<1)||(month>12)||(day<1)||(day>31))
{
cout<<"Illigal date. Aborting program.\n)";
exit(1);
}
}
void DayOfYear::output()
{
cout<<"The month is: "<<month;
cout<<"\nThe day is: "<<day;
}
void DayOfYear::set(int new_month,int new_day)
{
month=new_month;
day=new_day;
check_date();
}
int DayOfYear::get_month()
{
return month;
}
int DayOfYear::get_day()
{
return day;
}