Shifa
asked

Expert
Abhay Jajodia answered
Hi Shifa,
\n means new line.
If you put it before the text, it moves to a new line first, then prints the text.
cout << "\nHello";If you put it after the text, it prints the text first, then moves to the next line.
cout << "Hello\n";
So the difference is whether the line break happens before the message or after it.
If you have more questions, I am here to help 😊
C++
This question was asked as part of the Learn C++ Basics course.
Our Experts
Sudip BhandariHead of Growth/Marketing
Apekchhya ShresthaSenior Product Manager
Kelish RaiTechnical Content Writer
Abhilekh GautamSystem Engineer
Palistha SinghTechnical Content Writer
Sarthak BaralSenior Content Editor
Saujanya Poudel
Abhay Jajodia
Nisha SharmaTechnical Content Writer
Udayan ShakyaTechnical Content Writer