0

difference between return and cout

what is the difference between return and cout return a+b; cout<<a+b;

15th Nov 2016, 1:12 PM
Faminan Tioro
Faminan Tioro - avatar
1 Respuesta
+ 2
Cout is equivalent to printing something out. Return is for functions, and is the result of whatever the function does. So, you could do something like this: int sum(n1, n2) { return n1 + n2; } cout << sum(5, 8) << endl; cout << 5 + 8 << endl; // Both couts do the same thing
15th Nov 2016, 1:21 PM
Keto Z
Keto Z - avatar