/* Lecture code 0.2 * * Implementation of GetLine() from simpio.h. Uses the getline free function * from to read data into a string, then return it. */ #include #include // For string, getline using namespace std; /* Reads a full line of text from the user, then returns it. */ string GetLine() { string result; getline(cin, result); // Reads a full line from cin, stores in result. return result; } int main() { cout << "Please enter a string: "; string myString = GetLine(); cout << "You entered: " << myString << endl; return 0; }