CS 1440 pre-lab activities for Lab 10

Before coming to the lab, you should answer the following questions in writing.

You know how to write a C++ program to find the minimum and the maximum of some numbers that are either read from a file or are entered from the keyboard.  In this case, you do not need to remember all the numbers and you can read the numbers one-by-one and compare each one with the max or min and replace the min and/or max with the number in hand, if needed, until the last number is read.  But there are cases where you need to keep track of numbers that are entered or read.  For example, think of these questions.
How do you write a set 4 numbers in the reverse order of the way they are read?
How will you write a set of 4 numbers in ascending or descending order?

As you may immediately realize, now you have to remember all the numbers in order to be able to write them in a specific order.

1. Suppose your were asked to write a C++ program to read 4 integer values from the keyboard then find the largest (Max) and displays the list of all numbers on one column and their difference from the max on the second column.
Here is an example:

Input: 3 4 5 8
Max = 8

Num    Diff_from_Max
3            5
4            4
5            3
8            0

2. Suppose I tell you today that you can define 4 integers let's say x[0], x[1], x[2], and x[3] by using:
int x[4];

at the declaration.  The above statement will create x[0], x[1], x[2], and x[3].  Use these instead of a,b,c, and d (or any other variables that you have used in problem 1) to solve the problem.

3. Take a guess,  how do we define a set of 10 characters the same way?