Easy Tutorial
❮ Cpp Examples Calculator Switch Case Cpp Numbers ❯

C++ Example - Output with Newline

C++ Examples

Using C++ to output and insert newlines between multiple outputs, using \n or endl:

Example - Newline with \n

#include <iostream>
using namespace std;

int main() {
    cout << "tutorialpro \n";
    cout << "Google \n";
    cout << "Taobao";
    return 0;
}

Example - Newline with endl

#include <iostream>
using namespace std;

int main() {
    cout << "tutorialpro" << endl;
    cout << "Google" << endl;
    cout << "Taobao";
    return 0;
}

The above programs produce the following output:

tutorialpro 
Google 
Taobao

C++ Examples

❮ Cpp Examples Calculator Switch Case Cpp Numbers ❯