< previous page
page_762
next page >
Page 762
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:
TeamType
made up of classes (freshman, sophomore, etc.) on your campus.
ResultType
made up of game results (won, lost, or tied)
b. Using Typedef, declare an integer array type named
Outcome
, intended to be indexed by
TeamType
and
ResultType
.
c. Declare an array variable
standings
to be of type
Outcome
.
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
.
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
.
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
typedef char String20[21];
String20 oneName;
String20 nameList[50];
indicate whether each of the following is valid or invalid.
< previous page
page_762
next page >