text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

c01p049.cpp File Reference


Detailed Description

A function that is not fail-safe.

Date:
29 May 2006
Chapter:
Chapter 1
Page:
Page 49
Version:
5.0

Definition in file c01p049.cpp.

Go to the source code of this file.

Typedefs

typedef int TableType [TABLE_SIZE]

Functions

int index (int group)
void readData (TableType incomeData)

Variables

const int LOW_END = 10
const int HIGH_END = 100
const int TABLE_SIZE = HIGH_END - LOW_END + 1


Typedef Documentation

typedef int TableType[TABLE_SIZE]
 

Definition at line 21 of file c01p049.cpp.


Function Documentation

int index int  group  ) 
 

Returns:
The array index that corresponds to group number.

Definition at line 24 of file c01p049.cpp.

References LOW_END.

Referenced by readData().

void readData TableType  incomeData  ) 
 

Reads and organizes income statistics.

Parameters:
incomeData A TableType of income statistics.
Precondition:
The calling module gives directions and prompts user. Input data is error-free and each input line is in the form G N, where N is the number of people with an income in the G-thousand-dollar group and LOW_END <= G <= HIGH_END. An input line with values of zero for both G and N terminates the input.
Postcondition:
incomeData[G - LOW_END] = total number of people with an income in the G-thousand-dollar group for each G read. The values read are displayed.

Definition at line 41 of file c01p049.cpp.

References HIGH_END, index(), and LOW_END.


Variable Documentation

const int LOW_END = 10
 

Ten-thousand dollar income.

Definition at line 17 of file c01p049.cpp.

Referenced by index(), and readData().

const int HIGH_END = 100
 

100-thousand dollar income.

Definition at line 19 of file c01p049.cpp.

Referenced by readData().

const int TABLE_SIZE = HIGH_END - LOW_END + 1
 

Definition at line 20 of file c01p049.cpp.


Generated on Sat Aug 26 19:58:10 2006 for AWLogo by  doxygen 1.4.6