第七周项目三(2)求三数最大值

来源:互联网 发布:数据标注是什么 编辑:程序博客网 时间:2024/05/29 17:20

/*
 *Copyright (c) 2014, 烟台大学计算机学院
 *All rights reserved.
 *文件名称:week7-project3(2).cpp
 *作者:宋伟男
 *完成日期:2014年 10 月 11日
 *版本号:v1.0
 *
 *问题描述:输入三个整数a,b,c,输出其中最大值max
 *输入描述:三个整数,任意大小
 *程序输出:一个整数,代表三者最大值
 */

 

#include <iostream>

using namespace std;

int main()
{
    int a,b,c,max ;
    cout << "请输入三个正整数:" << endl ;
    cin >> a >> b >> c ;
    if (a >= b)
    max = a ;
    else max = b;
    if (c >= max)
    max = c ;
    else max = max ;
    cout << "三者最大值是" << max << endl;
    return 0;
}

运行结果:

0 0