I have to write a program that takes a series of alphabets and displays the repeating vowels and their corresponding occurrence. The input can be either lower case or upper case. For help, i can convert upper case to lower case and vice versa without affecting other characters.
Sample input: AsdatEhjTeEUuklIti
Sample output: Repeating vowels are
a 2
e 3
i 2
u 2
I came up with this code:
Code:#include <stdio.h> char tolower(char p); char toupper(char p); int main() { int z,p=1,a=0,i=0,o=0,u=0,e=0, f; char alpha[p]; char conv[f]; printf("\n Enter characters : \t"); while(scanf("%c",&alpha[p])!=EOF) { if(alpha[p]='A'||'E'||'I'||'O'||'U') { conv[f]=tolower(alpha[p]); } switch (conv[f]) { case 'a' : { a++; break; } case 'e' : { e++; break; } case 'i' : { i++; break; } case 'o' : { o++; break; } case 'u' : { u++; break; } default : { break; } } f++; } printf("\n a=\t %d",a); printf("\n e=\t %d",e); printf("\n i=\t %d",i); printf("\n o=\t %d",o); printf("\n u=\t %d",u); return 0; } char toupper(char p) { int x; x = (int)p - 32; return x; } char tolower(char p) { int x; x = (int)p + 32; return x; }
Any idea how to proceed to a right solution? Thanks



1Likes
LinkBack URL
About LinkBacks


