Input Stream
Cin is object of iostream. Like cout, if “using namespace std;” is written before main function then write cin directly to get input. With omitting “using namespace std;”, cin is written as std::cin together with >> (extraction operator) to get input from user and assign that input to a variable or array.
In following program, we declared two variables and get two numbers from user using cin together with >> and assign both numbers to two variables. Then add both numbers and display as output using cout.

Output
Post a Comment