#include
void main()
{ int i,s,r[5],n,k;
char buffer[100001],*p;
float f[5];
n=0;
while ( gets(buffer) )
{ n++; p=buffer;
for ( i=0;i<5;i++ ) r[i]=0;
s=0;
while ( *p )
{ if ( ((*p)>='a' && (*p)<='z') || ((*p)>='A' && (*p)<='Z') )
{ s++;
switch ( *p )
{ case 'a':
case 'A': r[0]++; break;
case 'e':
case 'E': r[1]++; break;
case 'i':
case 'I': r[2]++; break;
case 'o':
case 'O': r[3]++; break;
case 'u':
case 'U': r[4]++; break;
}
}
p++;
}
for ( i=0;i<5;i++ ) { f[i]=r[i]; f[i]/=s; }
printf("case %d :\n",n);
i=0; printf("A : %.4f%%\n",f[i]*100);
i++; printf("E : %.4f%%\n",f[i]*100);
i++; printf("I : %.4f%%\n",f[i]*100);
i++; printf("O : %.4f%%\n",f[i]*100);
i++; printf("U : %.4f%%\n",f[i]*100);
printf("\n");
}
system("pause");
}
int i=0,cnta=0,cnte=0,cnti=0,cnto=0,cntu=0,cntother=0;
char s[1000000]="abcdefghijklmn";
while(s[i]!=NULL)
{
switch(s[i++])
case 'a':cnta++;break;
case 'e':cnte++;break;
case 'i':cnti++;break;
case 'o':cnto++;break;
case 'u':cntu++;break;
default:cntother++;break;
}
会写了吗?