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

#45703
Anonymous
Inactive

A handy little trick when trying to track down the cause of mysterious compiler messages is to break everything down to simpler statements.

So instead of this:
[code:1:63263c739d]
cout<<"Today is:"date1.tostring()<<endl;
cout<<"you are"<<date1 – date2<<"days old1\n";
[/code:1:63263c739d]

rewrite it like this:
[code:1:63263c739d]
cout<<"Today is:";
coutdate1.tostring();
cout<<endl;
cout<<"you are";
cout<<date1 – date2;
cout<<"days old1\n";
[/code:1:63263c739d]

The compiler will then give you a much more accurate error message.