cout and cin in C++


Prev Tutorial Next Tutorial

cout and cin in C++

cout<<: cout is used for print message on screen

Example

	
#include<iostream.h>
#include<conio.h>

void main() 
{  
 int num;  
 clrscr();  
 cout<<"Hello word !";  // print message on screen
 getch();  
}  

Output

	
Hello word !

cin

cin>>: cin is used for get or read value form keyboard.

Example

	
#include<iostream.h>
#include<conio.h>

void main() 
{  
 int num;  
 clrscr();  
 cout<<"Enter any number:";
 cin>>num;  // accept one value form keyboard
 cout<<"Number is: "<<num;
 getch();  
}  

Output

	
Enter any number :100
Number is: 100

Prev Tutorial Next Tutorial

Google Advertisements
Download Projects

Google Adsense Advertisements

Buy 3 Year Old Domain, Tutorialday.com, SeosmoTools.com @$200

Buy This Ad Space @$50 per Month, Ad Size 300X250 Contact on: hitesh.xc@gmail.com WhatsApp no. 8882538826

Yahoo Advertisements