Check out example codes for "c++ reading string". It will help you in understanding the concepts better.

Code Example 1

#include <iostream>
#include <string>
string str;
getline(cin, str);
//str contains line

Learn ReactJs, React Native from akashmittal.com