|
#include <iostream.h>
#include <math.h>
//#include <distance.h>
double distance(double a,double b,double c,double d)
{
int res;
res=squr((power((a-c),2)-power((b-d),2)),2);
if(res<0)
res=-res;
return res;
}
void main()
{
double a,b,c,d;
cout<<"Please input two points,like 2 3 reprents (2,3):"<<endl;
cin>>a>>b>>c>>d;
cout<<"the distance of the two points is :"<<distance(a,b,c,d)<<endl;
}
这是计算两点尖距离的程序,math类里面的方法都不清楚,帮我看一下计算语句res=squr((power((a-c),2)-power((b-d),2)),2);
如何改动??谢谢 |
|