max)max = b;if (c > max)max = c;if (d > m_c++打擂台找第二大的值">
赞
踩
遇到比较多的数据时,我们通常采用"打擂台"的方法处理
- #define _CRT_SECURE_NO_WARNINGS 1
- #include<stdio.h>
- int main()
- {
- int a, b, c, d, max;
- scanf("%d%d%d%d", &a, &b, &c, &d);
- max = a;
- if (b > max)
- max = b;
- if (c > max)
- max = c;
- if (d > max)
- max = d;
- printf("%d\n", max);
- system("pause");
- return 0;
- }
![](https://csdnimg.cn/release/blogv2/dist/pc/img/newCodeMoreWhite.png)
本文出自 “顺势而为” 博客,请务必保留此出处http://lk123456.blog.51cto.com/10831443/1766968
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。