sqrt函数使用(重载函数调用)

Posted qq1480040000

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sqrt函数使用(重载函数调用)相关的知识,希望对你有一定的参考价值。

/*
time:2020年4月16日21:01:50
where:gfdx
function:重载函数调用---sqrt函数使用*/
#include<iostream>
#include<cmath>
using namespace std;
//重载1
float sroot(float a)
{
	return sqrt(a);
}
//重载2
int sroot(int a)
{
	return sqrt(a);
}
//重载3
double sroot(double a)
{
	return sqrt(a);
}
int main() {
	int a;
	cin >>a;
	cout <<sqrt(a) << endl;//输出重载函数
	return 0;
}

  

以上是关于sqrt函数使用(重载函数调用)的主要内容,如果未能解决你的问题,请参考以下文章