Back to course

User Input (cin)

C++ Masterclass: From Zero to Hero

To get user input, we use std::cin with the extraction operator >>. cpp int x; std::cout << "Enter a number: "; std::cin >> x;