Programs revisited
comment block identifying who you are and what the
program does
/************************************************************************
* Programmer: Dan Bennett *
* Program 1, Grandmother's Trunk *
* CSCI 130, Section1, Spring 2003 *
* *
* This program will play the game of "In Grandmother's Trunk" by *
* printing a series of items that were packed in grandmothers trunk *
* *
* no input is required for this program *
************************************************************************/
include files
#include <iostream>
#include <string>
using namespace std;
Constant declarations
const string MainPhrase = "In my grandmother\'s trunk, I packed ";
const string FirstClause = "a ";
const string SecondClause = " and a ";
int main () {
Variable Declarations
string FirstItem; // the first item packed into the trunk
string SecondItem, // the second item packed into the trunk
ThirdItem; // the third item packed into the trunk
string ItemClause; // the constructed item clause
// assign the values of the things we are packing
FirstItem = "flower";
SecondItem = "shirt";
// construct and print out the first round of the game.
ItemClause = FirstClause + FirstItem;
cout << MainPhrase << endl << ItemClause << "." << endl;
// construct and print out the second round of the game
ItemClause = ItemClause + SecondClause + SecondItem;
cout << MainPhrase << endl << ItemClause << "." << endl;
return(0);
}