#include <stdio.h>
#include <string.h>
int main()
{
int i;
int counter=0, counter2=0;
char *s;
char name[30];
char vowel[6] = "AEIOU";
char consonants[21] = "BCDFGHJKLMNPQRSTVWXYZ";
printf ("input the string: ");
scanf ("%s", name);
printf ("The string is %s\n", name);
for (i=0; name[i]!='\0'; i++) {
if (s = strchr(vowel, name[i])) {
counter++;
}
else if (s =strchr(consonants, name[i])) {
counter2++;
}
printf ("First counter is %d\n", counter);
printf ("The second counter is %d\n", counter2);
return 0;
}
}
Run Code Online (Sandbox Code Playgroud)
问题是,我的代码出了什么问题?为什么柜台不起作用?因为我尝试了很多方法,没有任何作用,也许有人可以为我解释.
| 归档时间: |
|
| 查看次数: |
2722 次 |
| 最近记录: |