previous | start | next

cout

The name cout is predefined of type ostream.

It is associated with a console window or screen output.



     int x = 5, y = 10;;
     const double pi = 3.1415926535897932384626433832795;
     cout << x;
     cout << "  ";
     cout << y;
     cout << "  ";
     cout << pi;

Output:
     5  10  3.14159

The same result can be obtained by

    cout << x << "  " << y << "  " << pi;

    

Note that the precision for pi got truncated in the output. We will soon see how to better control this.



previous | start | next