read in string c++ code example
Example 1: c++ reading string
#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Example 2: get data from terminal c++
int i;
cout << "Please enter an integer value: ";
cin >> i;