![]() |
VOOZH | about |
C++ provides the cout object, which is an instance of the ostream class (from the <iostream> library) and is commonly used to display output on the screen. For formatted output, 'cout' is used with the insertion operator '<<'. Example:
GeeksforGeeks!
Explanation:
cout ManipulatorBelow is the C++ program to demonstrate a manipulator that can be used with the cout object:
A computer science portal for geeks - Geeksforgeeks
Explanation: The text written inside the double quotes in the cout statement is printed exactly as it appears, while the value stored in the variable str is fetched at runtime and displayed after it.
In this example, the program reads a city name entered by the user and stores it in the name variable. After taking the input, the program displays the entered city name on the screen.
Input:
Mumbai
Output:
Mumbai
Explanation: