#include
#include
#include
#include
/* run this program using the console pauser or add your own getch, system (" pause ") or the input loop */
using namespace std;
Const int SIZE=100;
Int main (int arg c, char * * argv) {
Cout & lt; <"Enter the file for analysis.";
Char ch;
Int whitespace=0;
Int who=0;
Int chars=0;
Int punct=0;
Int others=0;
Char filename [SIZE];
Cin. Getline (filename, SIZE);
Ifstream inFile.
InFile. Open (filename);
if(! InFile. Is_open ())
Cout & lt; <"The Error404!"
While (inFile. Good ())//test for sentinel
{
If (isalpha (ch))//is it an alphabetic character?
Chars++;
Else if (isspace (ch))//is it a whitespace character?
Whitespace++;
Else if (isdigit (ch))//is it a digit?
Digits++;
Else if (ispunct (ch))//is it punctuation?
Punct++;
The else
Others++;
InFile & gt;> Ch;//get the next character
}
If (inFile. Eof ())
Cout & lt; <"Read over!"
return 0;
}
CodePudding user response:
May be skipped, flow operator have to skip the function of the blank charactersCodePudding user response:
Crab crab crab crab solved!