C++ User Input

Let's explore how we can take input from the user in C++.

Introduction

Until now, we have looked at output operation, where we take the data stored in memory and display it on the console. However, a program would be boring without any input operations. Imagine the Instagram app without any user interaction!

Input operation is the exact opposite of output operation. In input operation, we take data from the user and store it in the memory.

Syntax

The basic syntax for taking input from the user is given below:

Get hands-on with 1400+ tech skills courses.