Taking User Input

Learn how we can take input from users in C++.

We'll cover the following

In the previous chapter, we learned how the cout statement displays output to the console, but we did not discuss how it takes input in C++. In this lesson, we’ll explore how C++ uses its operators to take input from the user.

C++ input

C++ uses the statement cin and operator >> to get user input and store it in a memory location in C++. The basic syntax of how cin takes input is:

Create a free account to access the full course.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy