< previous page page_762 next page >

Page 762
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. int exampleC[8][2];
   int i, j;

   exampleC[7][0] = 4;
   exampleC[7][1] = 5;
   for (i = 0; i < 7; i++)
   {
        exampleC[i][0] = 2;
        exampleC[i][1] = 3;
   }
4. a. Define enumeration types for the following:
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
TeamType made up of classes (freshman, sophomore, etc.) on your campus.
ResultType made up of game results (won, lost, or tied)
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
b. Using Typedef, declare an integer array type named Outcome, intended to be indexed by TeamType and ResultType.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
c. Declare an array variable standings to be of type Outcome.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
d. Give a C++ statement that increases the number of freshman wins by one.
5. The following code fragment includes a call to a function named DoSomething.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
typedef float ArrType[100][20];

ArrType x;
  .
  .
  .
DoSomething(x);
Indicate whether each of the following would be valid or invalid as the function heading for DoSomething.
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
a. void DoSomething( /* inout */ ArrType arr )
b. void DoSomething( /* inout */ float arr[100][20] )
c. void DoSomething( /* inout */ float arr[100][] )
d. void DoSomething( /* inout */ float arr[][20] )
e. void DoSomething( /* inout */ float arr[][] )
f. void DoSomething( /* inout */ float arr[][10] )
6. Given the following declarations
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
typedef char String20[21];

String20 oneName;
String20 nameList[50];
3e26ecb1b6ac508ae10a0e39d2fb98b2.gif
indicate whether each of the following is valid or invalid.

 
< previous page page_762 next page >