#include using namespace std; main() { char s[1000]; string lastline, penultimate; while (!cin.fail()) { cin.getline(s, 1000); if (!cin.fail()) { penultimate = lastline; lastline = s; } cout << s << endl; } cout << "The last two lines were '" << penultimate << "' and '" << lastline << "'" << endl; }