Can anyone explain what we should prefer "\n" or '\n' for adding a newline character or both are actually the same thing?
# | User | Rating |
---|---|---|
1 | tourist | 3778 |
2 | Benq | 3592 |
3 | ecnerwala | 3521 |
4 | Um_nik | 3423 |
5 | jiangly | 3375 |
6 | Petr | 3342 |
7 | Radewoosh | 3337 |
8 | scott_wu | 3313 |
9 | maroonrk | 3265 |
10 | yosupo | 3259 |
# | User | Contrib. |
---|---|---|
1 | 1-gon | 205 |
2 | Errichto | 201 |
3 | rng_58 | 194 |
3 | SecondThread | 194 |
5 | awoo | 186 |
6 | vovuh | 183 |
7 | Um_nik | 182 |
8 | antontrygubO_o | 177 |
9 | Ashishgup | 175 |
10 | -is-this-fft- | 171 |
Can anyone explain what we should prefer "\n" or '\n' for adding a newline character or both are actually the same thing?
Name |
---|
Search google first result smh.
I had googled but can't understand the idea. Please if someone knows ,share his idea. Feel free to downvote as most people do to newbie .
According to what i gathered from the stack overflow thread you can do the following two
1.> while adding a new line after any numerical datatype use
'\n'
. example :cout << "age = " << age << '\n'; // more efficient
thancout << "age = " << age << "\n";
2.> If adding a newline after printing a string you can do
cout<<"checkoutput \n";
Thanks.Now understood the difference.