No errors? I get the following error:
prog.cpp: In function βint main()β:
prog.cpp:24: error: expected primary-expression before β<<β token |
Anyway, you've got bigger problems than that semi-colon at the end of line 23.
breakfast and lunch and dinner are strings. Not numbers. They are strings. When you add two strings like this:
string1 + string2
you get out the concatenated strings.
Here's an example. If string1 is "eggs" and string2 is "beans"
then string1+string2 will give you "eggsbeans".
If string1 is the string (NOT the number, but a string) "34" and string2 is the string "123"
then string1+string2 will give you the string "34123".
As it is, this
breakfast+lunch+dinner= totalcal;
is not at all doing what you probably meant.
Firstly, I expect you meant
totalcal = breakfast+lunch+dinner;
However, you need to read in breakfast and lunch and dinner not as strings, but as numbers. Making them
int rather than
string would do.