/*
*Copyright (c) 2014,烟台大学计算机学院
*All rights reserved.
*文件名称:first.cpp
*作者:刘天恩
*完成时间:2014年10月25号
*版本号:v1.0
*问描述:输入10个整数,找出最大数
*输入描述:输入10个整数
*程序输出:输出10个整数中的最大数
*/
#include <iostream>
using namespace std;
int main()
{
int k,x,max;
cin>>x;
max=x; //先让第一个输入的数为最大数
for(k=2;k<=10;k++)
{
cin>>x;
if(x>max) max=x; //如果输入的第二个数比一个输大,则max=第二个数
}
cout<<"max="<<max<<endl;
return 0;
}
运行结果: