您的位置:首页 > 其它

编写四个重载函数Double(x),返回值为输入参数的两倍;参数类型分别为int,long,float,double,返回值类型与参数类型一致。

2010-05-31 15:44 447 查看
#include<iostream>
using namespace std;

int Double(int x);
long Double(long x);
float Double(float x);
double Double(double x);

int main()
{
int myInt = 6500;
cout<<Double(myInt)<<endl;
long myLong = 65000;
cout<<Double(myLong)<<endl;
float myFloat = 6.5F;
cout<<Double(myFloat)<<endl;
double myDouble = 6.5e20;
cout<<Double(myDouble)<<endl;
}

int Double(int x)
{
return 2*x;
}
long Double(long x)
{
return 2*x;
}
float Double(float x)
{
return 2*x;
}
double Double(double x)
{
return 2*x;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐