306-135 INTRODUCTION TO PROGRAMMING
�ASSIGNMENT 2


Due Date: Sept. 9, 1999


PROBLEM: Write a program that simulates the child's game "My Grandmother's Trunk."� In this game, the players sit in a circle, and the first player names something that goes in the trunk: "In my grandmother's trunk, I packed a pencil."� The next player restates the sentence and adds something new to the trunk: "In my Grandmother's trunk, I packed a pencil and a red ball."� Each player in turn adds something to the trunk, attempting to keep track of all the items that are already there.

 

Your program should simulate just five turns in the game.� Starting with the NULL string, simulate each player's turn by concatenating a new word or phrase to the existing string, and print the results on a new line.� The output should be formatted as follows:

 

In my Grandmother's trunk, I packed a flower.

In my Grandmother's trunk, I packed a flower and a shirt.
In my Grandmother's trunk, I packed a flower and a shirt and a cup.

In my Grandmother's trunk, I packed a flower and a shirt and a cup and a blue marble.

In my Grandmother's trunk, I packed a flower and a shirt and a cup and a blue marble and a ball.

Program Output: First print out the your name, Howard U. ID number, course number and title, assignment number, and date, followed by a description of the problem. Then print the answer to the problem.


Program Documentation: At the top of your source code as a comment, include your name, Howard U. ID number, course number and title, assignment number, and date, followed by a description of the problem (This same information should also be printed out at the top of your output). Include comments as necessary throughout your program.

---------------------------------------------------------
Electronic Submission - SCS Laboratory

All C++ program assignments are now to be submitted electronically. Your program will be run using the instructors' data. For Assignment 2, name your C++ program file assign2.c and use the following command to submit your program:

$ Keeling assign2.c

The assignment is to be submitted electronically no later than 10:00pm on Sept. 8, 1999. The receiving file will be closed at 10:00pm and no late assignments will be accepted. If before Sept. 8th, you send in a version of your assignment, having already sent in an earlier version, the later version will automatically replace the earlier version in the assignment file.
---------------------------------------------------------
Electronic Submission � via E-mail

Your program can be submitted via E mail. If you select this mode of submission then you must make sure that� you make the subject of your message �assign4.c � and use the following E mail address

 

����������� [email protected]d.edu

 

The body of the message should be your source code listing with the program�s output as comments.