How does the user insert text? | SoloLearn: Learn to code for FREE!


How does the user insert text?


6/3/2020 6:40:21 PM


5 Answers

New Answer


Aman Kumar cin is "console" input not "character" input.


Use string data type string text; cin >> text; cout << text;


If you're dealing with console app, you need to look for cout<< for output and cin>> for user input Here's an example #include <iostream> using namespace std; int main () { int age; cout << "Please enter your age"; cin >> age; cout << "Your age is:" << age; return 0; }


cin >> is used to take input from the user. Simple meaning ("c")console ("in")input. And the extraction operator points towards cin in order to receive a stream of characters. Library needed iostrem. And examples are there only provided by above people.


If you want to add a character . Then do it like this . Char a; Cin>>a; And integers. Int N; Cin>>N; If you add any datatype you must need to include cin then you we'll be able to insert it.