|
|
|
|
|
|
|
Figure 14-8
Absence Records by Department |
|
|
|
|
|
|
|
|
struct DeptAbsences
{
int byDay[5];
float average;
}; |
|
|
|
|
|
|
|
|
Figure 14-10 depicts this structure. Notice that if all the processing on a two-dimensional array is either row processing or column processing, then an array of structs may reflect the problem and the processing better than a two-dimensional array. |
|
|
|
|
|
|
|
|
Data structures that accurately reflect the relationships among the data values in a problem lead to effective programs. The logic of the program is easier to understand because the data structures mirror the problem. The code of the program is easier to maintain because the logic of the program is clearer. The program is easier to modify because the data structure accurately represents the problem. |
|
|
|
|
|
|
|
|
Figure 14-9
Two-Dimensional Array of Ansentee Data |
|
|
|
|
|