1234567
string mystring; getline (cin, mystring); ofstream myfile; myfile.open ("example.txt", ios::app); myfile << "Writing here.\n"; myfile.close();
12345678910111213141516171819202122
using namespace std; #include <iostream> #include <string> #include <fstream> int main () { string mystring; cout << "What do you want to say? "; ofstream myfile; myfile.open ("conversaton.txt", ios::app); getline (cin, mystring); myfile << mystring << endl; myfile << "getline(cin, mystring)"; myfile.close(); return 0; }