Hello, could somebody help me with counting uppercase, lowercase, and digits in a text file? Here's my program
// Character Analysis
#include <iostream>
#include <fstream>
#include <cctype>
#include <string>
using namespace std;
int main()
{
char ch;
int charCount = 0;
int upperCount = 0;
int lowerCount = 0;
int digitCount = 0;
string text;
ifstream text;
text.open("text.txt");
cout << "Here is the analysis of characters in the text file" << endl;
text.get(ch);
while (text)
{
charCount++;
cout << ch;
if (isupper(text))
cout << upperCount++;
if (islower(text))
cout << lowerCount++;
if (isdigit(text))
cout << digitCount++;
}
}