0
take a look on this code
#include <iostream> using namespace std; int main() { int a=1; int b=3; int sum = a + b; cout << sum,"\nhello world"; return 0; } it prints 4 not 4 hello world
4 Respostas
+ 3
put << between sum and text
+ 5
Taste the comma is an operator used to separate statements/expressions. There are two statements:
cout << sum
and:
"\nhello world"
with the comma between them. The second doesn't have any effect as the result wasn't stored.
+ 2
replace , with <<
i'm not sure whats going on here i thought it wont compile or runtime exception thrown, but its not.
+ 2
thanks for cooperation