救救我吧= =
#include <stdio.h>
int totalScore(int score[], int N)
{
int i;
int sum = 0;
for (i = 0; i < N; i++)
{
sum += score[i];
}
return sum;
}
int maxScore(int score[], int N)
{
int j;
int max = score[0];
for (j = 0; j < N - 1; j++)
{
if (score[j + 1] > max)
max = score[j + 1];
}
return max;
}
int minScore(int score[], int N)
{
int k;
int min = score[0];
for (k = 0; k < N - 1; k++)
{
if (score[k + 1] < min)
min = score[k + 1];
}
return min;
}
int averageScore(int score[], int N)
{
int Sum = *totalScore;
int average = Sum / N;
return average;
}
int descendingScore(int score[], int N)
{
int m, temp;
for (m = 0; m < N - 1; m++)
{
if (score[m + 1] < score[m])
{
temp = score[m];
score[m] = score[m + 1];
score[m + 1] = temp;
printf("%d\n", score[m]);
}
else
{
printf("%d\n",score[m]);
}
}
return 0;
}
int main()
{
int score[10] = { 67,98,75,63,82,79,81,91,66,84 };
totalScore(score, 10);
maxScore(score, 10);
minScore(score, 10);
averageScore(score, 10);
descendingScore(score, 10);
getchar();
return 0;
}