2 Answers
New Answer#include <iostream> #include <fstream> #include <string> #include “brain.h” using namespace std; brain me; void conversation() { bool good = true; string res; while (good) { cin >> res; good = me.respond(&res); cout << res; } } int main() { ofstream fout(memory.txt, ios_base::app); ifstream fin(post.txt, ios_base::app); string line; while (getline(fin, line)) { fout << line; } fin.close(); fout.close(); cout << “I hope so too, I’ve memorized this post.” << endl; conversation(); }