#include #include #include using namespace std; // List of adjectives char *adjectiveList[] = { "silly", "jumping", "goofy", "red", }; // List of nouns char *nounList[] = { "cow", "cat", "car", "clown", }; // List of verbs char *verbList[] = { "runs", "hops", "jogs", }; string adjective() { // Pretend it takes a little while to think of this part usleep(rand() % 2000 * 1000); // Return a random phrase. return adjectiveList[rand() % (sizeof(adjectiveList) / sizeof(adjectiveList[0])) ]; } string noun() { // Pretend it doesn't tend to take too long for this part usleep(rand() % 1000 * 1000); // Return a random phrase return nounList[rand() % (sizeof(nounList) / sizeof(nounList[0]))]; } string verb() { // Pretend it might take a while to think of this part usleep(rand() % 4000 * 1000); // Return a random phrase return verbList[rand() % (sizeof(verbList) / sizeof(verbList[0]))]; } int main() { // Print out an ad lib cout << "The " << adjective() << " " << noun() << " " << verb() << " to the " << noun() << endl; }