// Modified from the book - A laboratory course in C++ by Nell Dale // by Janet Remen Oct 2000 as a lab for CPS 171. // Program enumslab.cpp reads characters from file DataIn and // writes them to DataOut with the following changes: // all letters are converted to uppercase, digits are // unchanged, and all other characters except blanks and // newline markers are removed. #include#include #include using namespace std; enum CharType {LO_CASE, UP_CASE, DIGIT, BLANK_NEWLINE, OTHER}; CharType kindOfChar(char); // function prototype // Gets the enumerator equivalent to its character input. int main () { ifstream dataIn; ofstream dataOut; char character; CharType kind; dataIn.open("ReFormat.dat"); dataOut.open("DataOut.txt"); dataIn.get(character); // priming read while (dataIn) { kind = kindOfChar(character); switch (kind) { // FILL IN THE Code to output the correct character case // etc. } // get next character dataIn.get(character); } return 0; } /*************************************************/ ***** kindOfChar(char character) // Post: character is converted to the corresponding // constant in the enumeration type CharType. { if (isupper(character)) return *****; // TO BE FILLED IN else if (islower(character)) return *****; // TO BE FILLED IN else if (isdigit(character) ) return *****; // TO BE FILLED IN else if (character == ' ' || character == '\n') return *****;// TO BE FILLED IN else return *****; // TO BE FILLED IN }