int x = 10;
cout << "Hello world!" << ++x;
return 0;
If you want to increment a variable, you should use ++x
. If you want to decrement it, use --x
.
And, if you want to show a variable next to another one, or next to another string, use <<
between them.