0
How does the user insert text?
3 ответов
+ 1
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;
}
+ 1
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.
+ 1
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.