+ 1
Why is endl used??
5 Answers
+ 8
A concise answer provided by @Ace in this thread:
https://www.sololearn.com/Discuss/1111250/?ref=app
+ 1
Assuming you are talking about C++, 'endl' is used to specify the end of a line
Example:
int main() {
cout << "Hello World!";
cout << "C++ is awesome!";
}
Output:
Hello World!C++ is awesome!
Using endl:
int main() {
cout << "Hello World!" << endl;
cout << "C++ is awesome!";
}
Output:
Hello World!
C++ is awesome!
Other ways to do this are:
cout << "Hello World!" << "C++ is awesome!";
OR
cout << "Hello World!\nC++ is awesome!";
Let me know if I can clear any doubts :)
+ 1
endl is a manipulator instead of \n
+ 1
endl is a manipulator..used to print newline
+ 1
Endl is used to skip or print a new line to output on the compiler