The following C++ program does not compile

  • Topic: C/C++ 
  • Thread starter soul5
  • Start date
  • Tags Tags
    C++ Program
2 replies · 3K views · last reply
soul5
Messages
63
Reaction score
0
count << "2 + 3 * 5 = " 2+3*5 << endl;


do I just need to put it as

count << "2 + 3 * 5=" << (2+3*5) << endl;
 
soul5 said:
count << "2 + 3 * 5 = " 2+3*5 << endl;do I just need to put it as

count << "2 + 3 * 5=" << (2+3*5) << endl;

First one is bad, second one looks good.

Why don't you simply compile the second, run and test it? ooO, does the second one also throws error?
 
I'm pretty sure you can't mix string output together with variables. You must separate them into with <<.