How to display output using C  ?


We can display the output using C++ in using the cout standard output stream of library iostream. The library iostream support the basics input and output operations. We can take input and also display and some data or output using iostream library.

How to include iostream.h library?

This library is mostly default included into the compiler the environment or platform we use e.g Microsoft Visual C++ .

#include <iostream>

Program to display the data or output on screen using C++

First we will display the directly then in second below program we will store some strings into a variable and then we will display it using the cout standard output stream.

#include <iostream> using namespace std; int main() { cout<<"Hello World"; return 0; }

Output of C++ display Output

Hello World
Let's we store some string into the variable and then we will display the variable. #include <iostream> using namespace std; int main() { string mystring="Hello World"; cout<<mystring; return 0; }
Chapter Next »