九度OJ 1046 求最大值
题目链接:http://ac.jobdu.com/problem.php?pid=1046
题目分析:
不分析了,太简单了=。= 注意一下输入的时候是多组吧。
源代码:
#include <iostream> using namespace std; int main() { int a[10] = {0}; while (cin>>a[0]) { for (int i = 1; i < 10; i++) { cin>>a[i]; } int max = 0; max = a[0]; for (int i = 1; i < 10; i++) { if (max < a[i]) { max = a[i]; } } cout<<"max="<<max<<endl; } return 0; }