现在的位置: 首页 > 综合 > 正文

九度OJ 1046 求最大值

2012年04月29日 ⁄ 综合 ⁄ 共 288字 ⁄ 字号 评论关闭

题目链接: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;
}

 

 

抱歉!评论已关闭.