C++ Programming


cout<< statement tutorials
-
cout is object of class ostream that is used to print message written within quotes on the screen or we can also say that it represents the standard output stream oriented to narrow characters of type char.
-
As an object of class ostream, characters can be written to it either as formatted data using the insertion operator (operator<<) or as unformatted data, using member functions such as write.
-
cout object is declared in header <iostream> with external linkage and static duration: it lasts the entire duration of the program.
C++ program to understand variable declaration |
|
![]() |
//Program name test004.cpp//Understanding variable declaration# include <iostream.h>void main(){int a,b; // declaring variables a and ba=50; // assign value to ab=60; // assign value to bint c=70; // declare and assign value same timecout<<"a="<<a <<" b="<<b<<"\n";cout<<"c="<<c;} |
Output |
a=50 b=60c=70 |