< previous page page_482 next page >

Page 482
Module Structure Chart:
0482-01.gif
//******************************************************************
// CategoryCount program
// An input file is opened and echo-printed.  A table is printed to
// show the percentage of characters in the file that belong to
// five categories: uppercase letters, lowercase letters, decimal
// digits, blanks, and end-of-sentence punctuation marks.
// ASSUMPTION:  Percentages are based on total number of
// characters in the file
//******************************************************************
#include <iostream.h>
#include <iomanip.h>    // For setprecision()
#include <fstream.h>    // For file I/O
#include <ctype.h>      // For isupper(), islower(), isdigit()

void CalculateAndPrint( int, int, int, int, int, int );
void IncrementProperCounter( int&, int&, int& int&,
                             int&, int&, char ) ;

int main()
{
    int      upperCount = 0;        // Number of uppercase letters
    int      lowerCount = 0;        // Number of lowercase letters
    int      digitCount = 0;        // Number of digits
    int      blankCount = 0;        // Number of blanks
    int      puncCount = 0;         // Number of punctuation marks
    int      leftOverCount = 0;     // Number of other characters
    char     inputChar;             // Current input character
    ifstream inFile;                // Input text file

 
< previous page page_482 next page >