#include using namespace std; main() { char s[1000]; char *lastline; char *penultimate; int line; line = 0; while (!cin.fail()) { cin.getline(s, 1000); if (!cin.fail()) { line++; if (line > 2) delete penultimate; if (line > 1) penultimate = lastline; lastline = new char [strlen(s)+1]; strcpy(lastline, s); } cout << s << endl; } if (line == 0) exit(0); if (line == 1) { cout << "The last line was '" << lastline << "'" << endl; } else { cout << "The last two lines were '" << penultimate << "' and '" << lastline << "'" << endl; } }