使用Dev-c++
#include<stdio.h>
int main() {
int a, b, c;
c=1;
int you = 0;
int xiu = 0;
int mei = 0;
scanf("%d", &a);
for (int i = 0; i <= a; i = i + 1) {
if (i == a&&c==1)
{
getchar();
c = 0;
}
else {
scanf("%d ", &b);
if (b < 60)
mei = mei + 1;
else if (b < 85 && b >= 60)
you = you + 1;
else
xiu = xiu + 1;
}
}
printf("%d %d %d", xiu, you, mei);
}
测试输入:7 85 59 86 60 84 61 45
理想结果:2 3 2
运行时,数据输入完后,再多次回车+空格输入均无反应,必须得再输入任意字母、数字等符号后才出结果