/*
* Copyright (c) 2012, 烟台大学计算机学院
* All rights reserved.
* 文件名称:test.cpp
* 作者:王心垚
* 完成日期:2012 年10 月11 日
* 版本号:v1.0
* 输入描述:输入a,b
* 问题描述:输入四个整数,输出其中的最大值。
* 程序输出:“四个整数中的最大值”
* 问题分析:略
* 算法设计:略
*/
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,max1,max2,max;
cout <<"请输入4个整数:";
cin >>a>>b>>c>>d;
if(a>b)
max1=a;
else
max1=b;
if(c>d)
max2=c;
else
max2=d;
if(max1>max2)
max=max1;
else
max=max2;
cout<<"四个数中的最大值:"<<max<<"\n";
return 0;
}
运行结果:
心得体会:
还是很生疏