Success!

Okay I made my first successful C++ program. It’s called “Funny Story.exe” instead of madlibs which is probably copyrighted. Anyhoo. It’s merely a shell. Firstly I need to write a small story and then put it in the program. Right now it just uses named constants which will be substituted for real input later, and variables that I can plug anything into. This will need to be recompiled each time I change it until I make it interactive. Here’s the program, note I probably won’t always put whole programs in here as they’ll eventually get large an unweildly.

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

#include "stdafx.h"

const std::string AN_ANIMAL = "bear";
const std::string ACTION = "flog";
const std::string PLURALNOUN = "chipmunks";

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

// in lieu of input
animal = AN_ANIMAL;
verb = ACTION;
pluralnoun = PLURALNOUN;

// Output
std::cout < < "One upon a time in a far away kingdom there lived a " << animal << std::endl;
std::cout << "who liked to " << verb << " " << pluralnoun << ". " << std::endl;

return 0;
}

And here is my illustrious (spelling?) output:

D:\Programming Projects\MSDEV\Projects\Funny Story\Debug>”Funny Story.exe”
One upon a time in a far away kingdom there lived a bear
who liked to flog chipmunks.

Welp what do you think?

Keith

Comments are closed.