键盘输入三个数,输出其中最大的数

来源:互联网 发布:好听的淘宝昵称小清新 编辑:程序博客网 时间:2024/05/01 16:43

有三个整数a,b,c,由键盘输入,输出其中最大的数。

#include "stdafx.h"
#include<iostream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
int a,b,c,max;
cin>>a;
cin>>b;
cin>>c;
if((a>b)&&(a>c))
{
max = a;
}
else if((b>a)&&(b>c))
{
max = b;
}
else
{
max = c;
}
cout<<"最大数为:"<<max<<endl;
return 0;
}

0 0
原创粉丝点击