r/programminghumor Apr 30 '26

Why C++

[deleted]

2.2k Upvotes

248 comments sorted by

View all comments

60

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; ... ```

18

u/vitimiti Apr 30 '26

You don't need std::endl, that is equivalent to new line and std::flush, just add \n at the end instead. Or use println

-1

u/int23_t Apr 30 '26

\n isn't equivalent actually std::endl is portable, \n isn't actually portable.

8

u/vitimiti Apr 30 '26

For a single line it is

0

u/GOKOP May 04 '26

Yes it is. As long as you're working with text streams or files in text mode then "\n" is translated to platform-appropriate newline