int peopleNum = 0; printf("输入班级总人数:"); scanf("%d",&peopleNum); printf("%d\n",peopleNum); int sum = 0; //定义分数数组 int scoles[] = {0}; //循环接收每个同学的成绩 for (int i = 0; i < peopleNum; i++) { int scole = 0; printf("输入第%d个同学的成绩:",i+1); scanf("%d",&scole); scoles = scole; sum += scoles; }
上面程序不能正常运行,当i = 2时,会将scole的值赋给peopleNum,这是为什么????
|