计算两坐标的长度

来源:互联网 发布:淘宝李宁乒乓球运动服 编辑:程序博客网 时间:2024/04/30 13:26



-(void)calculateLength:(int)x1 andY1:(int)y1 andX2:(int)x2 andY2:(int)y2

{

    int length;

    length = sqrt(pow((x2 - x1),2) +pow((y2 - y1), 2) );

    NSLog(@"两点的长度为%d",length);

}

1 0