|
|
|
|
|
|
|
 |
|
|
|
|
|
|
|
|
//******************************************************************
// CountAll program
// This program counts the frequency of occurrence of all printable
// characters in a text file.
//
// The program assumes use of the ASCII character set. If your
// machine uses the EBCDIC character set, the constant definitions
// for NUM_CHARS, MIN_CHAR, and MAX_CHAR must be modified as shown
// in the comments at that location
//******************************************************************
#include <iostream.h>
#include <iomanip.h> // For setw()
#include <fstream.h> // For file I/O
#include <ctype.h> // For isprint()
#include "bool.h" // For Boolean type
const int NUM_CHARS = 128; // Number of chars in ASCII char set
const char MIN_CHAR = ' '; // First printable char (ASCII)
const char MAX_CHAR = 'ÿ'; // Last printable char (ASCII)
// Substitute the following if your machine uses EBCDIC:
// const int NUM_CHARS = 256; // Number of chars in EBCDIC
// const char MIN_CHAR = ' '; // First printable char (EBCDIC)
// const char MAX_CHAR = '9'; // Last printable char (EBCDIC)
void Print( const int[] );
void ZeroFreqCount( int[] );
int main()
{
int freqCount[NUM_CHARS]; // Frequency counts
char inputChar; // Temporary character
ifstream dataFile; // Input file to be analyzed |
|
|
|
|
|