杭电oj 2027 统计元音 C语言

#include

void main()
{
	int n, j, i, a, e ,u, o,sign;
	char s[100] = "0";
	while (~scanf_s("%d", &n))
	{
		getchar();
		for (j = 0; j < n; j++)
		{
			sign = a = e = u = i = o = 0;
			fgets(s, sizeof(s), stdin);
			while (s[sign])
			{
				switch (s[sign++])
				{
				case 'a':a++; break;
				case 'e':e++; break;
				case 'i':i++; break;
				case 'u':u++; break;
				case 'o':o++; break;
				default:break;
				}
			}
			printf("a:%d\n", a);
			printf("e:%d\n", e);
			printf("i:%d\n", i);
			printf("o:%d\n", o);
			printf("u:%d\n", u);
			if (n)printf("\n");
		}
	}
}

你可能感兴趣的:(c语言,算法,数据结构)