题解 | #获取两数中的较大值#
获取两数中的较大值
http://www.nowcoder.com/practice/136bd5e1021d4d698b9f5227d7dfb684
函数写法:
#include <iostream>
using namespace std;
int a,b;
int main()
{
cin>>a>>b;
cout<<max(a,b);
return 0;
}
打擂台的写法:
#include<bits/stdc++.h>//万能库
using namespace std;
int a,b;
int main()
{
cin>>a>>b;
if(a>b)cout<<a;
else cout<<b;
return 0;
}
ps:我个人不太喜欢打擂台,少打点字它不香吗
查看10道真题和解析