#include#include using namespace std; int main() { string line; getline(cin, line); // read a line from standard input cout << "You entered: " << line << endl; return 0; }
#includeThese examples utilize the standard C++ library.#include using namespace std; int main() { string line; ifstream myfile("example.txt"); // open file for reading if (myfile.is_open()) { getline(myfile, line); // read a line from file cout << "First line of file: " << line << endl; myfile.close(); // close file } return 0; }