cout statement in C++ | Display output in C++ 


cout statement in C++ | Display output in C++ 

cout stands for console output. cout statement in C++ is used to display value of a variable or a literal. cout statement is an instance of ostream class.

It is followed by insertion operator (<<) followed by a variable or a literal that you want to display.

The header file required to use cout is <iostream>.  You also need to import std namespace in the program as:

using namespace std;



Here, val refers to a variable or literal whose value you want to display.

//Program to demonstrate the use of cout statement in C++.

using namespace std;
int main()
int val;
cout<<"Enter a value=";
return 0;


Enter value of num=10

Spread the love
Lesson tags: cout statement in C++, display output in c
Back to: C++ Programming Notes
Spread the love