问题:
请编写程序,输入一点的横纵坐标,输出该点到原点的距离
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
struct Point
{
float x; //横坐标
float y; //纵坐标
};
int main()
{ struct Point p;
float l;
printf("请输入p1点的坐标:");
scanf("%f %f",&p.x ,&p.y);
l=sqrt((p.x*p.x)+(p.y*p.y));
printf("p1点到原点的距离为:%f\n",l);
return 0;
}