我的代码有一些问题,以获得 5 个元素的数组中的最高数字,这是我的代码:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
float timerunner1[4];
int x;
int main() {
for(x=1;x<6;x++) {
printf("Give me the time of runner 1: ");
scanf("%f",timerunner1[x]);
}
return 0;
}
这完美地工作,输出是:
Give me the time of runner 1: 14
Give me the time of runner 1: 3
Give me the time of runner 1: 10
Give me the time of runner 1: 5
Give me the time of runner 1: 2
如何获得数组的最高和最低数量?也许使用 for 或 if .. 如何?
谢谢!