Pages

cin>> & cout<< and basic programs

cin>> & cout<< 
जैसा कि c language में input के लिए scanf() और output के लिए printf() functions का उपयोग करते है।
उसी प्रकार c++ में input के लिए cin>> एवम output के लिए cout<< का use करते है। 
cout => cout का मतलब console output। यह iostream class का object है। 
<< => इसको output operator, insertion operator कहते है।
Eg.
cout<<"welcome to c++";

cin => cin का मतलब console input। यह iostream class का object है। 
>> => इसको input operator, extraction operator कहते है।
Eg.
cin>> x;
cin>> & cout<<  दोनो operators है। 

/*Program */

#include<iostream.h>
#include<conio.h>
int main(void)
{
 int x;
 clrscr();
 cout<<"Enter a number";
 cin>>x;
 cout<<"value of x="<<x;
 getch();
 return 0;
}

No comments:

Post a Comment