有三个整数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;
}
本文介绍了一个简单的C++程序,该程序接收用户输入的三个整数,并通过比较找到并输出这三个数中的最大值。文章包含完整的源代码,便于初学者理解和实践。
8031

被折叠的 条评论
为什么被折叠?



