0

what the there cin?

#include <iostream> using namespace std; int main() { int a, b; int sum; cout << "Enter a number \n"; cin >> a; cout << "Enter another number \n"; cin >> b; sum = a + b; cout << "Sum is: " << sum << endl; return 0; }

26th Jul 2016, 2:29 AM
Ч. Энхтайван
Ч. Энхтайван - avatar
8 Answers
0
i can not understand
26th Jul 2016, 2:30 AM
Ч. Энхтайван
Ч. Энхтайван - avatar
0
else any problem you can ask
26th Jul 2016, 4:50 AM
Tushar Chetan
Tushar Chetan - avatar
0
cin means console input .it is used to take input from users. like here you used cin a,b it will take input from the user and store in the variable a & b, after that it will add both the values of variable and it will store in "sum" and then it will show the value of the variable "sum"
26th Jul 2016, 4:51 AM
Tushar Chetan
Tushar Chetan - avatar
0
cin statement will help in taking the input. Here the user will enter the values at runtime for a and b . Suppose you enter a as 2 and b as3 then the output is: Sum is:5
26th Jul 2016, 7:55 AM
Programmer
0
One thing to know is std::cin will only take input up to a space. If there is a space any words after that space will be piled up in the buffer, which could potentially fuck up your program. Stick to individual inputs. When working with strings, use getline(), as that is what will accept space characters in strings.
26th Jul 2016, 8:01 AM
Cohen Creber
Cohen Creber - avatar
0
In simple words here cin takes the first input from the user and stores it in variable A( When u ask the user to enter the number first time N then u write cin>>a;) .... and then takes the second input from the user and stores it in variable B... (when u ask the user to enter onather number and then u write cin>>b;
26th Jul 2016, 2:33 PM
saurabh rana
saurabh rana - avatar
0
cin is used to take input from the user so while taking an input it is used
26th Jul 2016, 5:28 PM
Anirudh Gupta
Anirudh Gupta - avatar
0
cin means console input and use for take input from user in c like scanf as same.
29th Jul 2016, 4:17 PM
Vyas Arpit
Vyas Arpit - avatar