1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 08:26:20 +00:00
202401-programming-assignments/【实践课内】12.函数3/6-3 累计销售.md

46 lines
883 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 6-3 累计销售
下面代码中main函数三次调用函数fun,每次输入一组正整数,最后输出全部数据的最大值,最小值,总和,平均值。
定义函数fun完成一组数据处理每组数组个数不确定以负数结束输入空格分隔。
### 函数接口定义:
```c++
int fun (void);
fun返回值为这组数据的个数。不包括结束标志
```
### 裁判测试程序样例:
```c++
在这里给出函数被调用进行测试的例子。例如:
#include <stdio.h>
int max=0,min=9999999,total=0;
int fun (void);
int main()
{
int n;
n=fun();
n=fun();
n=fun();
printf("max=%d min=%d total=%d ave=%.1f",max,min,total,(float)total/n);
}
/* 请在这里填写答案 */
```
### 输入样例:
```in
10 20 30 50 -1
11 21 31 41 51 -1
55 56 60 -1
```
### 输出样例:
```out
max=60 min=10 total=436 ave=36.3
```