#include #include using namespace std; struct people { string name; int age; people * next; people(string n, int a, people * o) { name = n; age = a; next = o; } void printone() { cout << name << ", age " << age << "\n"; } }; int main() { people * all = NULL; while (true) { string n; int a; cout << "Enter name and age, or ctrl-D to end: "; cin >> n >> a; if (cin.fail()) break; all = new people(n, a, all); } cout << "The people you typed were:\n"; people * temp = all; while (temp != NULL) { temp->printone(); temp = temp->next; } cout << "All done\n"; }