sqrt function use (overload function call)

/ * 
time: April 16, 2020 21:01:50 
where: gfdx 
function: overloaded function call --- use of sqrt function * / 
#include <iostream> 
#include <cmath> 
using namespace std; 
// overload 1 
float sroot (float a) 
{ 
	return sqrt (a); 
} 
// overload 2 
int sroot (int a) 
{ 
	return sqrt (a); 
} 
// overload 3 
double sroot (double a) 
{ 
	return sqrt (a ); 
} 
int main () { 
	int a; 
	cin >> a; 
	cout << sqrt (a) << endl; // Output overload function 
	return 0; 
}

  

Guess you like

Origin www.cnblogs.com/qq1480040000/p/12716044.html
Recommended