Respuesta :
Answer:
Below is the c++ program with detail explanation on each line
Explanation:
// C++ program to demonstrate
// accessing of data members
#include <bits/stdc++.h>
#include <conio.h>
using namespace std;
int main() {
//Declaring variable for every type that we need to check
int totalUpperCase=0;
int totalLowerCase=0;
int totalWhiteSpaces=0;
int totalDigits=0;
//define x variable which will hold character input from user
char x;
while(x != '#'){ //execute until # character entered by user
x=getche(); //as we want from user to enter as many character as
//user wants without pressing enter key, that's why we use getche() which means
//get one character.
//isaplha method is used to check whether character is alphabet or not
if(isalpha(x)){
//isupper will check if entered character is upper case or not
if (isupper(x))
totalUpperCase++;
else
totalLowerCase++;
//isdigit method is used to check number
} else if(isdigit(x)){
totalDigits++;
} else if(x == ' '){
totalWhiteSpaces++;
}
}
//printing all the values here
cout<<"\n"<<"Total Upper Case Letters :" << totalUpperCase<<"\n";
cout<<"Total Lower Case Letters :"<<totalLowerCase<<"\n";
cout <<"Total White Spaces :"<< totalWhiteSpaces<<"\n";
cout << "Total Digits" <<totalDigits<<"\n";
// getche() at the end so that our programs wait until user presses any key
getche();
return 0;
}