您的位置:首页 > 其它

1140-面向对象程序设计上机练习一(函数重载)

2017-09-15 09:28 232 查看
#include <bits/stdc++.h>

using namespace std;

int Sort(int n);
float Sort(float n);
long Sort(long n);

int main()
{
int a;
float b;
long c;
cin >> a;

Sort(a);

cin >> b;

Sort(b);

cin >> c;

Sort(c);

return 0;
}

int Sort(int n)
{
int max = -123456;
for(int i = 0; i < 4; i++)
{
if(n >= max)
{
max = n;
}
cin >> n;
}
cout << max << endl;
return 0;
}

float Sort(float n)
{
float max = -123456;
for(int i = 0; i < 4; i++)
{
if(n >= max)
{
max = n;
}
cin >> n;
}
cout << max << endl;
return 0;
}

long Sort(long n)
{
long max = -123456;
for(int i = 0; i < 4; i++)
{
if(n >= max)
{
max = n;
}

4000
cin >> n;
}
cout << max << endl;
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: