# 用重载求距离.

#include <iostream>
#include <cmath>
using namespace std;
double func(int,int,int,int),func(double,double,double,double);
int  main( )
{ cout<<func(2,2,5,5)<<endl;
cout<<func(2.2,2.2,5.5,5.5)<<endl;
return 0;}

``````4.24264
4.6669``````

``````
#include <iostream>
#include <cmath>
using namespace std;
double func(int,int,int,int),func(double,double,double,double);
int  main( )
{ cout<<func(2,2,5,5)<<endl;
cout<<func(2.2,2.2,5.5,5.5)<<endl;
return 0;}
double func(int x1,int y1,int x2,int y2)
{return sqrt((x1-x2)* (x1-x2)+(y1-y2)*(y1-y2));}
double func(double x1,double y1,double x2,double y2)
{return sqrt((x1-x2)* (x1-x2)+(y1-y2)*(y1-y2));}
``````

``````
#include <iostream>
#include <cmath>
using namespace std;
double func(int,int,int,int),func(double,double,double,double);
int  main( )
{ cout<<func(2,2,5,5)<<endl;
cout<<func(2.2,2.2,5.5,5.5)<<endl;
return 0;}
double func(int x1,int y1,int x2,int y2)
{return sqrt((x1-x2)* (x1-x2)+(y1-y2)*(y1-y2));}
double func(double x1,double y1,double x2,double y2)
{return sqrt((x1-x2)* (x1-x2)+(y1-y2)*(y1-y2));}
``````