The cout object is used together with the << operator to display variables.

To combine both text and a variable, separate them with the << operator:

Example

int myAge = 35;
cout << "I am " << myAge << " years old.";



Practice Excercise Practice now