Taking User Input

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

We'll cover the following

In the previous chapter, we have learned how the cout statement displays output on the console but we did not discuss how it takes input in C++. In this lesson, we 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 at a memory location in C++. The basic syntax of how cin takes input is:

Create a free account to access the full course.

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