实现。函数形式为:doubledist(intx1,inty1,intx2,inty2);doubledist(doublex1,doubley1,doublex2,doubley2);#include<iostream.h>#include<math.h>doubledist(intx1,inty1,intx2,inty2){?return(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));}doubledist(doublex1,doubley1,doublex2,doubley2){?return(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));}voidmain(){intx1,x2,y1,y2;doublex11,x12,y11,y12;cin>>x1>>y1>>x2>>y2;cin>>x11>>y11>>x12>>y12;cout<<"dist1="<<dist(x1,y1,x2,y2)<<endl;cout<<"dist2="<<dist(x11,y11,x12,y12)<<endl;}用函数模板来实现:#include<iostream.h>#include<math.h>template<classT>doubledist(Tx1,Ty1,Tx2,Ty2){?return(sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));}voidmain(){intx1,x2,y1,y2;doublex11,x12,y11,y12;cin>>x1>>y1>>x2>>y2;cin>>x11>>y11>>x12>>y12;cout<<"dist1="<<dist(x1,y1,x2,y2)<<endl;cout<<"dist2="<<dist(x11,y11,x12,y12)<<endl;}