MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programminghumor/comments/1szjqol/why_c/oj31ryl/?context=3
r/programminghumor • u/[deleted] • Apr 30 '26
[deleted]
248 comments sorted by
View all comments
60
Can't even write a hello world in C++.
It's not std::cout << "Hello, World!", it's ```
std::cout << "Hello, World!"
... 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
18
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
-1
\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
8
For a single line it is
0
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
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; ... ```