INPUT AND OUTPUT STATEMENTS
Input (Read ) Statement.
You learned how to put data into variables using assignment statement .Now you will learn how to put data into variables using c++ input statement.
when the computer gets the data from the keyboard , the user is said to be acting interactively.
Putting data into variables using cin and the operator >>.The syntax of cin together with >> is
cin>>variable;
if two variables then
cin>>variable1>>variable2;
This is called an input statement. In c++ , >> is called the stream extraction operator.
By this way for so on variables ...
suppose that statement.
int feet;
int inches;
then input is
cin>>feet>>inches;
Output statements
In c++ output on standard output device is use cout and the operator << . The syntax for output statement is
cout<< expression;
This is called an output statement. In C++ , << is called the stream insertion operator.
This example surely help you in uderstanding the input and output statements.
#include <iostream>
using namespace std;
int main ()
{
double radius,area_circle;
cout <<"enter radius of circle:"<<endl; // output statement
cin>>radius; // input statement
area_circle= 3.14 * radius * radius;
cout<<"area_circle:="<<area_circle<<endl; // output statement
return 0;
}