// For C++ libraries. #include // Library for strings. #include // The c standard library, math and time libraries are needed. #include #include #include using namespace std; int randomItem(int max) { // Set the randomization seed to be based on the current time in seconds in Jan 1, 1970. srand((unsigned)time(0)); // Pick a random number from 0 to max. return rand()%max; } int main() { string days[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday", "Saturday"}; string verbs[]={"Went","Walked","Drove"}; string nouns[]={"to School","to Work","Home"}; int day,verb,noun; day=randomItem(7); verb=randomItem(3); noun=randomItem(3); cout << "On " << days[day] << " I " << verbs[verb] << " " << nouns[noun] << endl; return 0; }