Demo of Cin and Cout



In C++, cin and cout are part of the iostream library and are used for input and output operations.


Cin and Cout


Example

  #include<iostream.h>
    #include<conio.h>
         main()
        {
        int a,b,t;
        clrscr();
        cout<<”Enter The Value Of A :”;
        cin>>a;
        cout<<”Enter The Value of B :”;
        cin>>b;
        t= a+b;
        cout<<”Total :”<< t;

    getch();
}
Result

When you run the program and enter the values for A and B, it will display their sum:


Enter the value of A: 10
Enter the value of B: 10
Total: 20