您的位置:首页 > 其它

编写一个程序,用来求两个整数或三个整数中的最大数

2012-12-07 16:20 309 查看
#include<iostream>

using namespace std;

int main()

{ int max(int a,int b,int c);

int a=8,b=-12,c=27;

cout<<"max(a,b,c)="<<max(a,b,c)<<endl;

cout<<"max(a,b)="<<max(a,b)<<'\n';

return 0;

}

int max(int a,int b,int c)

{

if(b>a) a=b;

if(c>a) a=c;

return a;

}

int max(int a,int b)

{

if(a>b)

return a;

else

return b;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐