< Previous | Contents | Next >

The tellStory() Function

The tellStory() function takes all of the information entered by the user and uses it to display a personalized story.

void tellStory(string name, string noun, int number, string bodyPart, string verb)

{

cout << "\nHere’s your story:\n"; cout << "The famous explorer "; cout << name;

cout << " had nearly given up a life-long quest to find\n"; cout << "The Lost City of ";

cout << noun;

cout << " when one day, the "; cout << noun;

cout << " found the explorer.\n"; cout << "Surrounded by ";

cout << number; cout << " " << noun;

cout << ", a tear came to "; cout << name << "’s ";

cout << bodyPart << ".\n";

cout << "After all this time, the quest was finally over. "; cout << "And then, the ";

cout << noun << "\n";

cout << "promptly devoured "; cout << name << ". ";

cout << "The moral of the story? Be careful what you "; cout << verb;

cout << " for.";

}