// testToDigitValue.cpp
//
// Driver program (test program) to
// text the testToDigitValue function
// declared in textUtility.h and
// defined in textUtility.cpp.
#include "textUtility.h" // includes <iostream> and <string>
using namespace std;
/*
* Displays, to the terminal window, a
* table of return values of the function
* toDigitValue, with all possible in-range
* argument values and two out-of-range
* values, one at each of the two
* boundaries of the range.
*
* Global variable:
* cout - an ostream object for output to the terminal.
* cout is an external variable, declared
* in library header file <iostream>.
*/
int main()
{
cout << "Below is a table of values of toDigitValue:"
<< endl << endl;
// Print table headings:
cout << "Character Character's Returned" << endl;
cout << "Argument ASCII value int value" << endl;
cout << "--------- ----------- ---------" << endl << endl;
// Print table body:
for ( char x = '0' - 1; x <= '9' + 1; x++ ) {
// Display the character itself:
cout << " " << x;
// Display the character's ASCII value"
printRightJustified((int) x, 13, cout);
// Display the returned value of toDigitValue:
printRightJustified(toDigitValue(x), 13, cout);
// End the line:
cout << endl;
} // for i
return 0;
} // function main