Need help with error

I'm getting the following error when trying to compile the following function:

"Error: invalid operands of types int and const char [3] to binary operator"

How do I fix this?

1
2
3
4
5
string getFormattedDate()
{
	formattedDate = Date.getDay() << "/" << Date.getMonth() << "/" << Date.getYear();
	return formattedDate;
}
 
Date.getDay() << "/" << Date.getMonth() << "/" << Date.getYear();


From what I see, you are trying to use operator<< on Date.getDay().

Try this:

1
2
3

	formattedDate << Date.getDay() << "/" << Date.getMonth() << "/" << Date.getYear();
	return formattedDate;


PS. I hope you declared formattedDate somewhere.
Topic archived. No new replies allowed.