hello

header ads

CIN and COUT

 What is cin and cout in C++?

CIN : - cin is an object of the input stream and is used to take input from input streams like files, console, etc. 
COUT :-  cout is an object of the output stream that is used to show output
        Basically, cin is an input statement while cout is an output statement.
example program
#include <iostream>
using namespace std;
int main()
{
    int firstNumber, secondNumber, sum;
     cout << "Enter two integers: ";
    cin >> firstNumber >> secondNumber;
    sum = firstNumber + secondNumber;
   cout << firstNumber << " + " <<  secondNumber << " = " << sum;     
     return 0;
}

Post a Comment

0 Comments