My first C++ Program Redux

Well I modified my madlibs style program. I think i’m ready to move on now. But before I do I want to share with you this wonderful story. A story of mythical creatures and great heros, of villagers and problems, a story where good ultimately triumphs over evil :

There once was a unicorn who scared poor villagers and stomped down their butts. One day the village hired a Knight named Sir Mixalot. When the unicorn came out he tried to stomp down some butts, but Sir Mixalot defended them with his sword and shield. Finally Sir Mixalot asked the unicorn why he kept stomping down their butts. The unicorn could only spit stomping fire. Finally Sir Mixalot asked the villagers to go to a nearby stream and fill up a bucket with water. He took the bucket and tossed it into the unicorn’s mouth. The unicorn finally spoke and said, “Thank you, my throat has been stomping for ages.”

Quite epic, don’t you think? This wonderful monstrosity was brought to you by the program below :


// Funny Story.cpp : A wacky madlibs like program to turn boring
// normal stories into funny wacky ones!

#include "stdafx.h"

const std::string FICTIONAL_CREATURE = "unicorn";
const std::string ACTION = "stomp";
const std::string NAME = "Mixalot";
const std::string PLURAL_THING = "butts";

int main(int argc, char* argv[])
{
	// To hold words.
	std::string creature;
	std::string verb;
	std::string name;
	std::string nouns;

	// in lieu of input
	creature = FICTIONAL_CREATURE;
	verb = ACTION;
	name = NAME;
	nouns = PLURAL_THING;

	// Output
	std::cout < <
		"There once was a " << creature << " who scared " <<
		"poor villagers and " << verb << "ed down their" <<
		std::endl << 

		nouns << ".  One day the village hired a Knight" <<
		" named Sir " << name << ".  When the" <<
		std::endl << 

		creature << " came out he tried to " << verb <<
		" down some " << nouns << ", but Sir " << name <<
		" defended" <<
		std::endl << 

		"them with his sword and shield.  Finally Sir " <<
		name << " asked the " << creature << " why" <<
		std::endl << 

		"he kept " << verb << "ing down their " << nouns <<
		".  The " << creature << " could only spit " << verb <<
		"ing fire." <<
		std::endl << 

		"Finally Sir " << name << " asked the villagers" <<
		"to go to a nearby stream and fill" <<
		std::endl << 

		"up a bucket with water.  He took the bucket " <<
		"and tossed it into the " << creature << "'s" <<
		std::endl << 

		"mouth.  The " << creature << " finally spoke and said, " <<
		"\"Thank you, my throat has been" <<
		std::endl << 

		verb << "ing for ages.\"" <<
		std::endl;

	return 0;
}

whatcha think?

Keith

One Response to “My first C++ Program Redux”

  1. Nick Says:

    It was much better than my first C++ program… *stares at the console screen that is blinking “Hello World!”*

    Talk about digging up an old post. =D