#include<iostream>
#include<iomanip>
using namespace std;
/*求两个整数的平方和 和 两个实数的平方和*/
int sumOfSquare(int x ,int y)
{
return x * x + y * y;
}
double sumOfSquare(double x ,double y)
{
return x * x + y * y;
}
int main()
{
int a , b;
cout<<"输入两个整数:";
cin >> a >> b;
cout<<sumOfSquare(a,b)<<endl;
cout<<"输入两个实数:";
double c, d;
cin >> c >> d;
cout<<sumOfSquare(c,d)<<endl;
return 0;
}
c++简单的重载函数
最新推荐文章于 2022-11-08 12:06:33 发布