0
What is Insertion operator and extraction operator?
5 Antworten
+ 15
>> is a input operator used to take input with cin
+ 3
insertion operator
takes input from the console
e.g
cin >>
extraction operator
makes output to the console
e.g
cout <<
+ 3
>> Extraction Operator:
---------------------------------
It means read data from std input device and store at the given location by variable name. It is used with cin object for reading into variables.
cin>>var1[>>var2>>var3...];
Since more than one variable can be read in the single statement.
It is known as cascading input Such inputs can be terminated by
either of the following
- A spacebar key
- A Tab key
- An Enter key
eg
int a,b,c,d;
cin>>a>>b>>c;
<< Insertion Operator
--------------------------------
It means read data from variable and send it on to the std output device that is VDU. It is used with cout object for displaying variables or text.
1) To display simple message
cout<<"Message";
2) To display value of a variable
cout<<var;
3) Mix and match
cout<<"Message: "<<var
eg
int a,b,c,d;
cin>>a>>b>>c;
d = a + b + c;
cout<<a;
cout<<"Sum = "<<d;
0
can you kindly explain your question a little bit more
0
How to make website