How to find Vowels, Lowercase, and Number of occurance for each letter

This is my first post ever, so please bear with me as I do not quite understand how to post my code the way the forum accepts it.

As the title shows, I am trying to find the number of vowels, lowercase, and specific occurrence of each letter in a manually inputted string.

Here is my code:
#include<stdio.h>
#include<string.h>
#include<ctype.h>

int calVowel(char myStr[]);
int calUppercase(char myStr[]);
int calDigit(char myStr[]);
int calChar(char myStr[], char myChar);

int main()
{
char mystring[100];
printf("Type your string:\n");
gets(mystring);
int myVowel = calVowel(mystring);
printf("Total number of vowels are %i", myVowel);
int myUppercase = calUppercase(mystring);
printf("Total number of uppercase are %i", myUppercase);
int myDigit = calDigit(mystring);
printf("Total number of digits are %i", myDigit);

return 0;
}

// function to calculate the total number of vowel characters
// input: a string
// output: the number of vowel characters
int calVowel(char myStr[])
{
int countVowel = 0;
int vowelIdx = 0;
while (myStr[vowelIdx] != '\0')
{
if ((myStr[vowelIdx] == 'a') || (myStr[vowelIdx] == 'e') || (myStr[vowelIdx] == 'i') || (myStr[vowelIdx] == 'o') || (myStr[vowelIdx] == 'u'))
{
countVowel++;
}
vowelIdx++;
}

return (countVowel);
}

// function to calculate the total number of uppercase characters
// input: a string
// output: the number of uppercase characters
int calUppercase(char myStr[])
{
int size = 2;
int countUppercase = 0;
for (int calUppercase = 0; calUppercase <= size; calUppercase++)
{
char U = myStr[calUppercase];
if (toupper(U) == 1)
{
countUppercase++;
}
}
return countUppercase;
}

// function to calculate the total number of digital characters
// input: a string
// output: the number of digit
int calDigit(char myStr[])
{

int countDigit = 0;
for (int calDigit = 0; calDigit <= size; calDigit++)
{
char D = myStr[calDigit];
if (isdigit(D) == 1)
{
countDigit++;
}
}
return countDigit;
}

// function to calculate the total number of a specific characters in a string
// input: a string, a character
// output: the number of the character in the string
int calChar(char myStr[], char myChar)
{

int count = 0;

for (int calChar = 0; calChar <= size; calChar++)
{
if (myStr[calChar] == tolower(myChar) || myStr[calChar] == toupper(myChar))
{
count++;
}
}
return count;

}

The count vowel function works, but I cannot get the number of the lowercase nor the specific occurrence.

Can anyone help me find where the error is?
but I cannot get the number of the lowercase


You haven't written a function to do that.
the <> tags when adding a post turn it to code.

# lowercase... for(all the letters) if (letter >= 'a' && letter <= 'z') count++
//assuming ascii here.
Topic archived. No new replies allowed.