首页 > 其他 > 详细

有参函数的调用

时间:2017-11-09 23:24:51      阅读:181      评论:0      收藏:0      [点我收藏+]
#include <iostream>
using namespace std;
int max(int x,int y,int z=0);

int main(){
    
    int a,b,c,m;

    
    cout<<"请你输入两个整型的数字:"<<endl;
    cin>>a>>b;
    m=max(a,b);
    cout<<"The max of a b and c is:"<<m<<endl;
    
    cout<<"请你输入三个整型的数字:"<<endl;
    cin>>a>>b>>c;
    m=max(a,b,c);
    cout<<"The max of a b and c is:"<<m<<endl;
    
    return 0;
}

int max(int x,int y,int z){
    if(z>x)
    x=z;
    if(y>x)
    x=y;
    return x;
}

技术分享

有参函数的调用

原文:http://www.cnblogs.com/928990166li/p/7811621.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!