#include /////////////////////////////////// // Question/answer utility routine. unsigned getAnswer(string question, string answers) { unsigned i; for (;;) { cout << question+" ("+answers+") "; string ans; getline(cin, ans); if (ans.size() == 0) continue; i= (','+answers).find(","+ans, 0); if (i != string::npos) break; }// Now pointing at the ','. unsigned ansIndex= 0; for (;i>0;) if (answers[--i] == ',') ansIndex++; // Count the ','s. return ansIndex; } ////////////////////////////// /// Write out dots for effect. void dots(unsigned i) { system("sleep 1"); while (0 < i) { cout << "." << flush; i--; system("sleep 1"); } }