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; }
8 Answers
0
i can not understand
0
else any problem you can ask
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"
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
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.
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;
0
cin is used to take input from the user so while taking an input it is used
0
cin means console input and use for take input from user in c like scanf as same.