|
发表于 2022-3-13 19:46:19
|
显示全部楼层
不知道是否是你想要的结果
- int main()
- {
- int min = 1000, max = 0;
- int value[3][12] = {
- {0, 0, 0, 0, 0, 0, 0, 313, 355, 587, 496, 555},
- {598, 549, 331, 382, 266, 205, 278, 385, 415, 447, 381, 415},
- {349, 364, 475, 379, 306, 234, 266, 343, 0, 0, 0, 0}
- };
- int data = 0;
- int i, j, t, count;
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 12; j++)
- {
- if(value[i][j] != 0 && value[i][j] < min)
- min = value[i][j];
- else if(value[i][j] > max)
- max = value[i][j];
- }
- }
- printf("最小值:%.2f,最大值:%.2f\n", (float)min/10, (float)max/10);
- for (i = 0; i < 3; i++)
- {
- for (j = 0; j < 12; j++)
- {
- data =value[i][j];
- if (data)
- {
- printf("%d年%2d月:", i + 2014, j + 1);
- data = data - min;
- for (t = 1; data < 0; t++)
- {
-
- }
- for (count = 0; count < t; count++)
- {
- printf("*");
- }
- printf("\n");
- }
- }
- }
- return 0;
- }
复制代码- 最小值:20.50,最大值:59.80
- 2014年 8月:*
- 2014年 9月:*
- 2014年10月:*
- 2014年11月:*
- 2014年12月:*
- 2015年 1月:*
- 2015年 2月:*
- 2015年 3月:*
- 2015年 4月:*
- 2015年 5月:*
- 2015年 6月:*
- 2015年 7月:*
- 2015年 8月:*
- 2015年 9月:*
- 2015年10月:*
- 2015年11月:*
- 2015年12月:*
- 2016年 1月:*
- 2016年 2月:*
- 2016年 3月:*
- 2016年 4月:*
- 2016年 5月:*
- 2016年 6月:*
- 2016年 7月:*
- 2016年 8月:*
复制代码 |
|