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

Popular posts from this blog

Day 2 Talking about computer science 💻

Day 5💻

Day 12 “C comments”