+ 2
what is the difference between this codes even if they give me the same solution?
#include <iostream> using namespace std; int main() { cout << "This " << "is " << "awesome!"; return 0; } #include <iostream> using namespace std; int main() { cout << "This is awesome!"; return 0; }
1 Resposta
+ 3
There is no difference in output but you call it just sloppy code since one (2) is going to be more work and be harder to read. The use of more "<<" would be for a variable usally such as
int x = 5;
cout << "x equals " << x << endl;
Output: x equals 5
I hope this answers your question if not please tell me