//根據輸出結果,完成下面程序中max()函數的定義#include <iostream.h>int max(int x,int y,int z);void main(){int a=34,b=56,c=78;cout<<a<<"、"<<b<<"、"<<c<<"中的最大值為"<<max(a,b,c)<<endl;}int max(int x,int y,int z){}//程序的輸出結果為://34、56、78中的最大值為78
1 回答

收到一只叮咚
TA貢獻1821條經驗 獲得超5個贊
int max(int x,int y,int z)
{
if ( x < y )
x=y;
//到這里x >= y
if ( x < z )
x=z ;
//到這里x >= z
return x ; //返回最大的
}
添加回答
舉報
0/150
提交
取消