next up previous
Next: Console Input Up: Overview of C++ Previous: Functions

Console Output

The console output statement in the C++ is used to display a message or an output on the screen. In the program the statement used to display the message "
\begin{emph}
This is my first C++ program\end{emph}
was :

cout << "This is my first C++ program";

The << is the standard C++ output operator. This operator causes whatever expression is on its right side to be output to the device specified on its left side. "
\begin{emph}
cout\end{emph}
specifies the console as the device to display the output on.

Notice this statement ends with a semicolon. In fact all C++ statements end with a semicolon. The message
\begin{emph}
''This is my first C++ program''\end{emph}
is a string. In C++ a string is a sequence of characters enclosed between double quotes.


Yousef Haik
2/23/1998