cin >> is an input stream operator in C that reads space-delimited data from standard input and stores them in a specified variable. When used, the operator reads the next token in the input stream and writes the data to variables such as var1 and var2, using spaces as delimiters.
What is cin >>?
In C, cin >>
is an input stream operator used to read data from standard input (usually the keyboard). It reads data from the input stream into the specified variable.
Operation method
cin >>
The operator reads the next space-separated token in the input stream. If there is no more data in the input stream, it returns false
; otherwise, it returns true
.
Grammar
cin >>
The syntax is as follows:
cin >> var1 >> var2 >> ...;
Among them:
var1
, var2
, etc. are variables used to store input data. Example
int age; string name; cin >> age >> name;
In this example, cin >>
will read two values from standard input: One value is stored in the variable age
and the second value is stored in the variable name
.
The above is the detailed content of What does cin >> mean in c++. For more information, please follow other related articles on the PHP Chinese website!