Question: I'm having trouble getting my program to output this statement Enter a sentence: Test! There are 5 total characters. There are 1 vowel. There are

I'm having trouble getting my program to output this statement

Enter a sentence: Test!

There are 5 total characters. There are 1 vowel. There are 1 UPPERCASE letters. There are 3 lowercase letters. There are 1 other characters.

Here's my code:

#include

#include

#include

int main() {

char str[100];

int i;

int vowels=0;

int UC;

int LC;

int Others;

int c;

printf("Enter a sentence: ");

gets(s);

LC=countLC(&s);

UC=countUC(&s);

Others=countOthers(&s);

printf("There are %d total characters. ", ;

for(i=0; i

if(isVowel(str[i]))

vowels++;

}

printf("There are %d vowels. ", vowels);

printf("There are %d UPPERCASE letters. ", UC);

printf("There are %d lowercase letters. ", LC);

printf("There are %d other characters. ", Others);

return(0);

}

bool isVowel(char ch){

if (ch =='a' || ch=='e'|| ch=='i' || ch== 'o' || ch=='u' ||

ch =='A' || ch=='E'|| ch=='I' || ch== 'O' || ch=='U')

return true;

else

return false;

}

int countUC(char *str){

int count=0, i=0;

for(i=0; i

if(str[i]>=65 && str[i]<=90)

count++;

}

return count;

}

int countLC(char *str){

int count=0, i=0;

for(i=0; i

if(str[i]>=97 && str[i]<=122)

count++;

}

return count++;

}

int countOthers(char *str){

return countOthers;

}

int countVowel(char* str) {

char*s= str;

int vowel=0;

while(*s!='\0') {

if(isVowel(*s)) {

vowel++;

}

s++;

}

return vowel;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!