c++函数重载设计代码

#include 
using namespace std;
int addNum(int a,int b)
{
	return a + b;
}

double addNum(double a, double b)
{
	return a + b;
}

float addNum(float a, float b)
{
	return a + b;
}
int main()
{
	int x1=1, y1=2;
	double x2=3.234,y2=2.456;
	float x3=1.8, y3=1.9;
	cout << addNum(x1, y1) << endl;
	cout << addNum(x2, y2) << endl;
	cout << addNum(x3, y3) << endl;
	return 0;
}

你可能感兴趣的:(c++,算法,开发语言)