get input from console line c++ code example
Example 1: how to print a string to console in c++
// Just some basic format
#include <iostream>
#include <string>
using namespace std;
int main()
{
cout << "Print a String" << endl;
}
Example 2: how to read a line from the console in c++
#include <string>
std::string str;
std::getline(std::cin, str);
// The output of std::getline(std::cin, str) will be stored in str.