Day 26
C++ New Lines
New Lines
To insert a new line in your output, you can use the \n character:
Example
#include <iostream>
using namespace std;
int main() {
cout << "Hello World! \n";
cout << "I am learning C++";
return 0;
}
You can also use another << operator and place the \n character after the text, like this:
Example
#include <iostream>
using namespace std;
int main() {
cout << "Hello World!" << "\n";
cout << "I am learning C++";
return 0;
}
Comments
Post a Comment