19 lines
359 B
C
19 lines
359 B
C
#include <stdio.h>
|
|
|
|
static int totalScore;
|
|
int totalPersons;
|
|
|
|
void count(int a, int b, int c)
|
|
{
|
|
totalScore += a + b + c;
|
|
totalPersons++;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
printf("全局变量值: %d, %d\n", totalPersons, totalScore);
|
|
count(90, 100, 89);
|
|
count(95, 90, 79);
|
|
printf("平均成绩: %.2f\n", totalScore * 1.0 / totalPersons);
|
|
return 0;
|
|
} |