I'm trying to make a class that makes a date and lets the user edit the date.
date.h
I end up with a whole bunch of bugs that are alien to me.Code:#ifndef date #define date #include <iostream> #include <string> using namespace std; class date { private: enum m_e_month { January=1, Febuary=2, March=3, April=4, May=5, June=6, July=7, August=8, September=9, October=10, November=11, December=12 }; m_e_month m_month; short int m_sh_I_year; short int m_sh_I_day; void makeyear() { cout<<"enter the year:"; cin>>m_sh_I_year; } void makemonth() { bool redo=1; cout<<"Enter the month's name it must be capitalied."; while(redo) { string tmonth="0"; cin>>tmonth; ///////////////////////////////////////////////It set to 0 so is assumes nothings going to happen. If it weren't here thaen and infinite loop would start. redo=0; ///////////////////////////////////////////////I have to use ifs because switchs don't work. if(tmonth=="January") {m_month=January;} else if(tmonth=="Febuary") {m_month=Febuary;} else if(tmonth=="March") {m_month=March;} else if(tmonth=="April") {m_month=April;} else if(tmonth=="May") {m_month=May;} else if(tmonth=="June") {m_month=June;} else if(tmonth=="July") {m_month=July;} else if(tmonth=="August") {m_month=August;} else if(tmonth=="September") {m_month=September;} else if(tmonth=="October") {m_month=October;} else if(tmonth=="November") {m_month=November;} else if(tmonth=="December") {m_month=December;} else {redo=1;cout<<"invalad please try again:";} } } void makeday() { cout<<"enter the day(number)"; cin>>m_sh_I_day; } public: date(int a=0, m_e_month b=January, int c=-1) { m_sh_I_year=a; m_month=b; m_sh_I_day=c; } void printdate() { cout<<m_sh_I_year<<"/" <<m_month<<"/" <<m_sh_I_day; } void makedate() { makeyear(); makemonth(); makeday(); } }; #endif
80|error: expected unqualified-id before "int"
80|error: expected `)' before "int"
10|error: an anonymous union cannot have function members
98|error: abstract declarator `<anonymous class>' used as declaration


Reply With Quote

Bookmarks