Skip to main content

1.4) Your First C++ Program: Writing To An Output Stream


This is the relevant program statement:

cout << "Hello World!" << endl;

Explanation

  • cout is an output stream (an ostream object) representing console output - i.e., the terminal window from which the program was run
  • << is the stream insertion operator
  • The data to be inserted appears on the right
  • The ostream object to the left is the destination for the data
  • "Hello World!" is a string of characters; the double-quote character at the start and end is a delimiter and not part of the actual string
  • endl is a stream manipulator that sends OS-dependent line ending characters to an output stream and then flushes the output buffer so that pending output appears at its destination