+ 1
Can we use \n (escape sequences) instead of endl etc.. in c++
c++
2 Respostas
+ 5
Ofc, It's better when you have something in "", and when you use it like cout<<x; it's easier to just type endl. I don't know, I use both, depending on the situation
+ 1
Yes, you can. As you may know, C++ derived from C, where there were no endl, and the only way to make a new line was "\n", so C++ now has two ways to make a new line. But remember to write "\r\n" instead of just "\n" when you are writing to a file, not to a console.