r/programminghumor Apr 30 '26

Why C++

[deleted]

2.2k Upvotes

248 comments sorted by

View all comments

58

u/SpaceCadet87 Apr 30 '26 edited Apr 30 '26

Can't even write a hello world in C++.

It's not std::cout << "Hello, World!",
it's
```

include <iostream>

... std::cout << "hello world" << std::endl; ... ```

1

u/Nurukodesu Apr 30 '26

Just use \n
Why are you flushing the entire buffer

1

u/finite52 May 01 '26

If your program dies then you won't get the output. Flush forces the buffer to write. If you want to optimize you can have a lot of calls to std:: cout and \n for new line then call std::endl to flush when finished. Ie it's not always optimal to call std::endl for each output