template <class T>
int Max (T Arr[], int n){
// precondition: n is the number of valid elements in Arr[]
// postcondition: returns the index of the maximum value in Arr[]
};
Problem 2: (7.5 points)
Fill in the following table:
| Decimal | Binary | Hex |
| 1023 | ||
| 10100101 | ||
| C5 | ||
| 42 | ||
| 111 |
Problem 3: (5 points)
For the following code segment, show the values of x, y, *p, *q at the five places indicated.
int x = 3; int y = 5;
int *p = &x; int *q = &y; // 1a. x, y, *p, *q *p += y; // 1b. x, y, *p, *q y = x + *p; // 1c. x, y, *p, *q q = p; // 1d. x, y, *p, *q p = &y; // 1e. x, y, *p, *q
Last Updated: April 11, 1997 12:29 pm by