美文网首页
两数比大小

两数比大小

作者: 这么帅的人啊 | 来源:发表于2018-09-11 21:49 被阅读0次

给出两个数x和y,求出两数的大者

#include<iostream>
using namespace std;
int max(int x,int y)
{
    int z;
    if(x>y) z=x;
    else z=y;
    return z;
}
int main()
{
    int a,b,c;
    cout<<"Please input two numbers:\n";
    cin>>a>>b;
    c=max(a,b);
    cout<<"maximum number is "<<c<<endl;
    return 0;
}

相关文章

网友评论

      本文标题:两数比大小

      本文链接:https://www.haomeiwen.com/subject/wcepgftx.html