Home > Backend Development > C++ > body text

What does cin >> mean in c++

下次还敢
Release: 2024-04-26 17:57:42
Original
812 people have browsed it

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 does cin >> mean in c++

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 >> ...;
Copy after login

Among them:

  • var1, var2, etc. are variables used to store input data.

Example

int age;
string name;

cin >> age >> name;
Copy after login

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!

Related labels:
c++
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!