C++ Tutorial for Beginners 4: Outputting Text with Cout

In C++ we can output (or, in the lingo, "print") text using the cout object. We'll take a look at it and what we can do with it in this tutorial.



Download Source code as zip

#include <iostream>

using namespace std;

int main() {

    cout << "Starting program..." << flush;

    cout << "This is some text." << endl;

    cout << "Banana. " << "Apple. " << "Orange. " << endl;

    cout << "This is some more text." << endl;

    return 0;
}