text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

c01p050.cpp File Reference


Detailed Description

A function that includes fail-safe programming.

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

Definition in file c01p050.cpp.

Go to the source code of this file.

Functions

bool readData (TableType incomeData)


Function Documentation

bool readData TableType  incomeData  ) 
 

Reads and organizes income statistics.

Parameters:
incomeData A TableType of income statistics.
Precondition:
The calling program gives directions and prompts the user. Each input line contains exactly two integers 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. The values read are displayed. If either G or N is erroneous (either G < LOW_END, G > HIGH_END, or N < 0), the function ignores the data line and continues.
Returns:
Returns false if either G or N are erroneous (either G < LOW_END, G > HIGH_END, or N < 0) for any data line read. In this case, the calling program should take action. The return value is true if the data is error free.

Definition at line 37 of file c01p050.cpp.

References HIGH_END, index(), and LOW_END.


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