Input in C++ Last Updated : 01 Feb, 2021 Comments Improve Suggest changes Like Article Like Report Try it on GfG Practice The cin object in C++ is used to accept the input from the standard input device i.e., keyboard. it is the instance of the class istream. It is associated with the standard C input stream stdin. The extraction operator(>>) is used along with the object cin for reading inputs. The extraction operator extracts the data from the object cin which is entered using the keyboard. Program 1: Below is the C++ program to implement cin object to take input from the user: C++ // C++ program to demonstrate the // cin object #include <iostream> using namespace std; // Driver Code int main() { int i; // Take input using cin cin >> i; // Print output cout << i; return 0; } Input: Output: Note: Multiple inputs can also be taken using the extraction operators(>>) with cin. Program 2: Below is the C++ program to implement multiple inputs from the user: C++ // C++ program to demonstrate the taking // multiple inputs from the user #include <iostream> using namespace std; // Driver Code int main() { string name; int age; // Take multiple input using cin cin >> name >> age; // Print output cout << "Name : " << name << endl; cout << "Age : " << age << endl; return 0; } Input: Output: Comment More infoAdvertise with us Next Article Input in C++ N nikhilchhipa9 Follow Improve Article Tags : C++ Programs C++ cpp-input-output Input and Output Input Output Systems +1 More Practice Tags : CPP Similar Reads cin in C++ In C++, cin is an object of istream class that is used to accept the input from the standard input stream i.e. stdin which is by default associated with keyboard. The extraction operator (>>) is used along with cin to extract the data from the object and insert it to the given variable.Let's t 4 min read Output in C++ In this article, we will discuss the very basic and most common I/O operations required for C++ programming. C++ runs on lots of platforms like Windows, Linux, Unix, Mac, etc. This is the most basic method for handling output in C++.The cout is used very often for printing outputs, i.e., on the moni 2 min read Take String as Input in C++ Strings are used to store the textual information. Taking a string as input is a very common operation used in almost all fields of programming. In this article, we will look at different ways to take string as input.The simplest way to take string as the user input is to use cin object. Let's take 2 min read How to Validate User Input in C++ Validating the user input is very important for any program to ensure that the data being processed is correct and meaningful. In C++, various techniques can be used to validate the user input and in this article, we will learn how to validate the user input in C++. Validate User Input in C++To vali 4 min read How to Read Input Until EOF in C++? In C++, EOF stands for End Of File, and reading till EOF (end of file) means reading input until it reaches the end i.e. end of file. In this article, we will discuss how to read the input till the EOF in C++. Read File Till EOF in C++The getline() function can be used to read a line in C++. We can 2 min read Like