class type

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2007
Posts: 67
Reputation: mauro21pl is an unknown quantity at this point 
Solved Threads: 0
mauro21pl mauro21pl is offline Offline
Junior Poster in Training

class type

 
0
  #1
Jul 18th, 2007
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)



#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;
}
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: class type

 
0
  #2
Jul 18th, 2007
15 ISO C++ forbids declaration of `privite' with no type
The error says it all. private is misspelled.
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 67
Reputation: mauro21pl is an unknown quantity at this point 
Solved Threads: 0
mauro21pl mauro21pl is offline Offline
Junior Poster in Training

Re: class type

 
0
  #3
Jul 18th, 2007
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.
Thanks
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: class type

 
0
  #4
Jul 18th, 2007
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.
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 67
Reputation: mauro21pl is an unknown quantity at this point 
Solved Threads: 0
mauro21pl mauro21pl is offline Offline
Junior Poster in Training

Re: class type

 
0
  #5
Jul 18th, 2007
o yeee. thats right, all the time i thought about the member function name. That explain everything. thanks a lot
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 486
Reputation: Bench has a spectacular aura about Bench has a spectacular aura about Bench has a spectacular aura about 
Solved Threads: 48
Bench's Avatar
Bench Bench is offline Offline
Posting Pro in Training

Re: class type

 
0
  #6
Jul 18th, 2007
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.
Last edited by Bench; Jul 18th, 2007 at 6:34 pm.
¿umop apisdn upside down?
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC