0
why cant we use \n for new line instead of endl
cout<<"hello world\n"; cout<<"i love programming"; //prints same without endl
4 Antworten
+ 1
because many people came c programming background and we use every time \n so we used \n
0
You can. If that is what you prefer, feel free to do so. However, it's not the typical standard convention and when working with a group or team may be frowned upon in some cases. I usually use \n if i need a newline somewhere before the end of that statement, but use endl if it is the last argument. For me this tends to be easier to read when looking over old code. Also, using \n requires less typing, so that's a plus in my book. ;-)
0
"\n"can be used anytime you like, i feel its an alternative but basically "endl" is a standard ok?
0
Ofeoritse c haven't any 'endl' code, so!!