Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 433 Bytes

8.Cin.md

File metadata and controls

24 lines (18 loc) · 433 Bytes

Cin

To take input from the user via console, we use the cin statement. 

cin is a predefined variable that reads data from the keyboard with the extraction operator (>>).

Example1:

int x; 
cin >> x; // Get user input from the keyboard
cout << x;
Input: 5
Output: 5

Example2:

string x; 
cin >> x; // Get user input from the keyboard
Input1: “Hello”
Output1: “Hello”