Assignment 3 for CSCI 201

Description:

In this assignment, you are asked to write two programs. First you will write a program that uses iterative statements to print the multiplication table for two numbers.

The second program will remind you of Christmas by answering the question, "On the 'x' day of Christmas, what did my true love sent to me?" The details are below.

Program 1:

(worth 15 points)

Write a program that generates (calculates each product) and displays the following multiplication table:

  
   1  2  3  4  5  6  7  8  9  
1  1
2  2  4
3  3  6  9
4  4  8 12 16
5  5 10 15 20 25
6  6 12 18 24 30 36
7  7 14 21 28 35 48 49
8  8 16 24 32 40 45 56 64
9  9 18 27 36 45 54 63 72 81

Program 2:

(worth 10 points)

The file christmas.cpp contains part of a program that will output the words of the song, "The Twelve Days of Christmas." Your assignment is the complete the program so that it will generate the following output:


On the first day of Christmas,
My true love sent to me:
A partridge in a pear tree.


On the second day of Christmas,
My true love sent to me:
	Two turtle doves, and
A partridge in a pear tree.


On the third day of Christmas,
My true love sent to me:
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the fourth day of Christmas,
My true love sent to me:
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the fifth day of Christmas,
My true love sent to me:
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the sixth day of Christmas,
My true love sent to me:
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the seventh day of Christmas,
My true love sent to me:
	Seven swans a-swimming,
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the eighth day of Christmas,
My true love sent to me:
	Eight maids a-milking,
	Seven swans a-swimming,
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the nineth day of Christmas,
My true love sent to me:
	Nine ladies dancing,
	Eight maids a-milking,
	Seven swans a-swimming,
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the tenth day of Christmas,
My true love sent to me:
	Ten lords a-leaping,
	Nine ladies dancing,
	Eight maids a-milking,
	Seven swans a-swimming,
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the eleventh day of Christmas,
My true love sent to me:
	Eleven pipers piping,
	Ten lords a-leaping,
	Nine ladies dancing,
	Eight maids a-milking,
	Seven swans a-swimming,
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.


On the twelfth day of Christmas,
My true love sent to me:
	Twelve drummers drumming,
	Eleven pipers piping,
	Ten lords a-leaping,
	Nine ladies dancing,
	Eight maids a-milking,
	Seven swans a-swimming,
	Six geese a-laying,
	Five golden rings,
	Four calling birds,
	Three French hens,
	Two turtle doves, and
A partridge in a pear tree.

What to turn in:

Both programming assignments must be turned in by transferring the respective C++ source code files to your ftp directory for this class. For each program, only the source code file (i.e., the file with the .cpp extension) should be turned in. The source code for program 1 should be named prog1.cpp and the source code for program 2 should be named prog2.cpp.