C++ Language comes with many libraries which help us to perform input and output operations.
In C++ sequence of bytes corresponding to input and output is commonly called as stream.
There are two types of streams :
1-> INPUT STRAEM : In input stream the direction of flow of bytes occurs from input device to main memory.
Ex -> Keyboard to main memory.
2->OUTPUT STREAM : In output stream the direction of flow of bytes occurs from main memory to Output device.
Ex->Display.
<< These symbol in c++ is called INAERSTIONAL operator.
>> and these symbol are called EXTRAXCTION operator.
//cin>> is a function which helps us enter value in terminal.
// BASIC INPUT AND OUTPUT IN C++.
#include <iostream>
using namespace std;
int main()
{
int num1,num2;
cout<<"enter the value of num1:\n"; /* '<<' these symbol are called Insertion operator ->
iska mtlab hai jo bhi output hai
yaani jo bhi user ne likha hua hai
usko screen pe print karwa do
-> for example enter the value of num1
jo likha hua hai mene, usko screen pe print krwa do */
cin>>num1; /* '>>' these symbol are called Extraction operator
-> Cin function hai which helps us to write in Terminator
->Extraction operator ka mtlb hai jo bhi value
user ab terminator mai input krne waala hai usko le lo
Hamne likh rakha hai Cin>>num1 to iska mtlab hogga ki num1 ke ander
user jo bhi value enter krega usko lelo */
cout<<"enter the valof num2:\n";
cin>>num2;
cout<<"the sum is:\n"<<num1+num2<<"\n";
return 0;
}
Comments
Post a Comment