1#include <iostream> // for std::cout
2
3//std::cout outputs Strings, numbers and variables to the commandline
4int main()
5{
6 int x = 1
7 std::cout << "Hello" << " world!\n" << x;
8 /* outputs: Hello world!
9 1 */
10////////////////////////////////////////////////////////////////////////////////////
11 // cout does not make a new line for each call
12 std::cout << "The answere: ";
13 std::cout << 42;
14 /* outputs: The answere: 42 */
15///////////////////////////////////////////////////////////////////////////////////
16 // std::endl and \n are both newlines
17 // std::endl adds a newline and makes sure the text gets displayed immediately
18 // "\n" adds a newline.(cout makes it display immediately by default)
19 std::cout << "step1" << std::endl
20 << "step2" << '\n'
21 << "end";
22 /* outputs: step1
23 step2
24 end */
25//////////////////////////////////////////////////////////////////////////////////
26 return 0;
27}
28
29//The operator << gets overloaded by iostream to change its usage to what you see above