User Program Communication
User Input in C++
Used to receive input (int, word, byte, etc.) from the user using the header file.
cin >> Variable; //input is stored to a variable
>> takes input from cin, which is the standard input stream.
Inputs can only be variables to store the inputted data.
Input data comes from the console.
cin is part of the std namespace. This means that you must either use std::cin if the namespace isn't used.
using namespace std; int inputData; cout << "Enter your age: "; cin >> inputData; cout << "Your age is: " << inputData << " years."; //Output is: Your age is (user input) years.