Home Forums Programming help with codes, can’t spot mistakes Reply To: help with codes, can’t spot mistakes


using namespace std;

int main()
Date date1(23,2,2010);//initialise a date with today’s date
Date date2;//define a date

//ask user to input date ie to define date2
int tmp;
cout<<"please input your date of birth"<<endl;
cout<<"year: ";
cin>> tmp;

//ask year to user until it is a valid year
//earlier on setyear()returns a false if user input invalid data

cout<<"Invalid year"<<endl<<"year:";
cin>> tmp;

//ask days to user until it is a valid day
cout<<"Invalid month"<<endl<<"year:";

cout<<"Today is:"date1.tostring()<<endl;
cout<<"you are"<<date1 – date2<<"days old1\n";

return 0;
ok i know i probably should figure out this error out myself, but i’ve been stuck for 15 minutes, so please somebody out there, help me!!
the error msg is:
error C2146: syntax error : missing ‘;’ before identifier ‘date1’
i checked around thayt area n it looks fine…
the error occurs at this line
[code:1:33a8ff0200]cout<<"Today is:"date1.tostring()<<endl;[/code:1:33a8ff0200]