Lab 6 - Using Output Parameters
Due - November 8/9, 2004
In this lab, you will write a program that uses pointers and
functions with output parameters. Your program will ask the user
for four integers, sort the integers, then print them in sorted
order. Your program should have three functions. Function 1
should get the four integers from the user. Function 2 should
sort the integers. Function 3 should print the results.
As you design your program, think carefully about which arguments
will need to be passed as pointers, and which will not. An
argument should only be passed as a pointer if the function will
change the value.
Implementation Hints
Store your numbers in four integer
variables, for example int_1 int_2 int_3 and int_4.
Your sorting function should have a predefined order for the
variables, and sort the numbers based upon that order. For example,
in this case you might define the order by specifying that
int_1 will hold the smallest number and int_4 will
hold the largest number after sorting. In that case, you should
rearrange the values of the variables such that the smallest number is
stored in int_1, the next in int_2, and the largest
in int_f.
Part 1 - Due - Monday, November 1, 2004 - 8:35AM
Submit a program design and series of test cases.
Part 2 - Due - November 8/9, 2004 - Beginning of Lab
Submit your completed code.
- Make sure that each function is well documented. Your documentation should specify the type and role of the input paramaters and ouput.
- Copy and paste the output of your program to the bottom of your program itself. Make sure the output is a comment. That means, put a /* before the output and a */ after the output.
Sami Rollins