菜鸟求助。。。恳求各路大神上来帮助
c语言吧
全部回复
仅看楼主
level 12
黑曼巴LGLG 楼主
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main()
{
int i,n;
char a[90];
while (1)
{
n=0;
gets(a);
for (i=0;i<strlen(a);i++)
{
switch (a[i])
{
case 'a':
case 'A':
case 'e':
case 'E':
case 'i':
case 'I':
case 'o':
case 'O':
case 'u':
case 'U':n++;break;
}
}
printf("%d\n",n);
}
return 0;
}
这个程序输出超限。。。。肿么修改啊???????
2014年11月28日 00点11分 1
level 12
黑曼巴LGLG 楼主
我顶。。。。。。
2014年11月28日 00点11分 2
level 14
都不知道你想要做什么←_←
2014年11月28日 01点11分 3
统计元音字母个数
2014年11月28日 01点11分
level 10
目的说出来啊
2014年11月28日 01点11分 4
统计元音字母个数
2014年11月28日 01点11分
每个后面都加上n++;break;
2014年11月28日 01点11分
回复水草汜斜阳:试过了。。。时间超限。。。
2014年11月28日 01点11分
回复 水草汜斜阳 :加了还是输出超限。。。
2014年11月28日 01点11分
level 12
黑曼巴LGLG 楼主
这是是个统计元音字母个数的题目。。。
2014年11月28日 01点11分 5
level 14
首先你得知道switch ()语句的特点,每个case语句后边没加break;它还会往下执行的!
2014年11月28日 01点11分 6
这个我知道啊。。。。
2014年11月28日 01点11分
回复 黑曼巴LGLG :把n++;break;copy到每个case语句后吧,可以加快统计
2014年11月28日 01点11分
回复光棍一声笑:试试。。。
2014年11月28日 01点11分
回复光棍一声笑:一样是输出超限。。。。。
2014年11月28日 01点11分
level 5
什么叫做超限呀?怎么我运行就没有问题
2014年11月28日 01点11分 7
我是OJ提交的
2014年11月28日 01点11分
把它放在外面的话就不是多组输入啦
2014年11月28日 01点11分
level 3
你说的超限应该是指while循环停不下来吧,把循环条件改一下,比如 while(gets(a)),这样当遇到EOF时循环就会停止,程序就能正常退出。
2014年11月28日 01点11分 8
我试试看。。。感谢您。。。
2014年11月28日 01点11分
1