cin string in c++ code example
Example 1: c++ reading string
#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
Example 2: working with char and string c++
String and Char
#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line
String and Char