Enter two integer: 3 5
Their sum of square: 34
Enter two real number: 2.3 5.8
Their sum of square: 38.93
#include <iostream>
using namespace std;
int sumOfSquare(int a, int b)
{
return a * a + b * b;
}
double sumOfSquare(double a, double b)
{
return a * a + b * b;
}
int main()
{
int m, n;
cout << "Enter two integer: ";
cin >> m >> n;
cout<<"Their sum of square: "<<sumOfSquare(m, n)<<endl;
double x, y;
cout << "Enter two real number: ";
cin >> x >> y;
cout<<"Their sum of square: "<<sumOfSquare(x, y)<<endl;
return 0;
}
最后
以上就是贪玩冬瓜最近收集整理的关于重载函数应用举例的全部内容,更多相关重载函数应用举例内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复