std::endl, which one should I use, '\n'?

Asked 2 years ago, Updated 2 years ago, 161 views

If you look at the C++ book, std::cout << "Test line" << std::endl; You shared a room

The code that other people made std::cout << "Test line\n"; There are more things that I wrote together What's the difference between the two? Or is it just that each person has a different style?

c++ coding-style iostream

2022-09-22 16:45

1 Answers

There's only one difference between the two.

So if you don't want to do flush often, use '\n' Or write std::endl.

"Changing the line" itself doesn't make any difference in any way.


2022-09-22 16:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.