taking console input cpp code example
Example 1: c++ read console input
// Include the library for console in-/outputs
#include <iostream>
// Include the libary for strings
#include <string>
// Main function
int main()
{
// Initialize variable
std::string value;
// Read from console
std::getline(std::cin, value);
}
Example 2: how to get input from the console in c++
int age;
cin >> age;