Input in C++ Last Updated : 23 Jul, 2025 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 info N nikhilchhipa9 Follow Improve Article Tags : C++ Programs C++ cpp-input-output Input and Output Input Output Systems +1 More Explore C++ BasicsIntroduction to C++3 min readData Types in C++6 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++5 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++11 min readFile Handling through C++ Classes8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++6 min readPolymorphism in C++5 min readEncapsulation in C++4 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL3 min readIterators in C++ STL10 min readC++ STL Algorithm Library3 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like