//Azimuth inverse calculation;calculate the distant and angle according to known coordinates
# include <stdio.h>
# include <math.h>
# define PI 3.1415926
int main()
{
double AngleTransfer(int a,int b,int c);//transfer the angle from array into radian.
double dx,dy,distant,a[2],b[2];//a[2] means xa and ya,so as b[2];and dx,dy is the
int alpha[3];//storage the angle as an array-degree,minute and second
printf("please input xa,ya:\n");
scanf("%f %f",&a[0],&a[1]);
printf("please input alpha:\n");
scanf("%d %d %d",&alpha[0],&alpha[2],&alpha[3]);
printf("intput the distant:\n");
scanf("%f",&distant);
dx=a[0]+distant*cos(AngleTransfer(alpha[0],alpha[1],alpha[2]));
dy=a[1]+distant*sin(AngleTransfer(alpha[0],alpha[1],alpha[2]));
b[0]=a[0]+dx;
b[1]=a[1]+dy;
prinft("bx is:%d\nby is %d\n",b[0],b[1]);
return 0;
}
double AngleTransfer(int a,int b,int c)
{
double angle;
angle=(a+b/60+c/3600)*180/PI;
return angle;
}
Devc++遇到的问题,编译完成显示[Error] ld returned 1 exit status,代码放下面
答案:1 悬赏:0 手机版
解决时间 2021-03-10 08:13
- 提问者网友:我是女神我骄傲
- 2021-03-10 01:05
最佳答案
- 五星知识达人网友:洒脱疯子
- 2021-03-10 02:37
scanf("%d %d %d",&alpha[0],&alpha[2],&alpha[3]);
这里数组越界,下标应该是0,1,2;
scanf("%f %f",&a[0],&a[1]);
scanf("%f",&distant);
double类型输入需要用%lf
改掉后运行就没问题了
这里数组越界,下标应该是0,1,2;
scanf("%f %f",&a[0],&a[1]);
scanf("%f",&distant);
double类型输入需要用%lf
改掉后运行就没问题了
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯