Computer Science, asked by fa19cse055, 8 months ago

Develop a program to find the total number of uppercase,

lowercase and other character(s) in any string entered by the user

using pointer notation as a parameter to the function.​

Answers

Answered by Anonymous
1

Answer:

program to count the uppercase,

// lowercase, special characters

// and numeric values

#include<iostream>

using namespace std;

// Function to count uppercase, lowercase,

// special characters and numbers

void Count(string str)

{

int upper = 0, lower = 0, number = 0, special = 0;

for (int i = 0; i < str.length(); i++)

{

if (str[i] >= 'A' && str[i] <= 'Z')

upper++;

else if (str[i] >= 'a' && str[i] <= 'z')

lower++;

else if (str[i]>= '0' && str[i]<= '9')

number++;

else

special++;

}

cout << "Upper case letters: " << upper << endl;

cout << "Lower case letters : " << lower << endl;

cout << "Number : " << number << endl;

cout << "Special characters : " << special << endl;

}

// Driver function

int main()

{

string str = "#GeeKs01fOr@gEEks07";

Count(str);

return 0;

}

Similar questions