找出该数组中的最大数。

给一维数组输入7个整数,找出该数组中的最大数。
程序运行结果如下:
输入:
234 12 34 56 34 23 89
输出:

234

送分题+1

#include<iostream>
using namespace std;
int main(){
	int n,x,max;
	cin>>max;
	for (int i=2;i<=7;i++){
		cin>>x;
		if (x>max)	max=x;
	}
	cout<<max;
	return 0;
} 

猜你喜欢

转载自blog.csdn.net/qq_41928880/article/details/80024897
今日推荐