CS 2213 Advanced Programming, Spring 2001 Lab Assignment 2


Due Thursday, February 8, 2001


Write a function:
void printTree15(int vals[]);
which takes an array of size at least 15 as its parameter.
This will print the elements of the array on 4 lines in tree form.
The root of the tree (vals[0]) will be on a line by itself ending at position 40.
The next line will contain vals[1] ending at position 20 and vals[2]ending at position 60.
The third line will contain vals[3] through vals[6] ending at positions 10, 30, 50 and 70.
The last line will contain vals[7] through vals[14} ending at positions 5, 15, 25, 35, 45, 55, 65 and 75.
For example, one line of your function might be:
printf("%20d%40d\n",vals[1],vals[2]);
or you might use three lines:
printf("%20d",vals[1]);
printf("%40d",vals[2]);
printf("\n");

Put the function in a file called printtree15.c and write a main program to test this. The main program should start by printing your name. Use a makefile and use separate compilation. Be sure to also run lint.

Run the test program to produce sample output. Use cut and paste to send the output to cs2213 as part of a mail message with subject line:
cs 2213 lab assignment 2 results

Be sure that you use cut and paste. Do not send your results as an attachment which assumes a particular type of mail reader. Make sure you send this to cs2213 and not to srobbins.

Do not send this email before Friday, February 2.