《C语言及程序设计》实践参考——坐标转换

#include<stdio.h>
#include<math.h>
#define pI 3.1415926
int main()
{
    float r,theta,x,y;
    scanf("%f %f",&r,&theta);//双引号之间不可空格,否则会出错
    x=r*cos(theta/180*pI);
    y=r*sin(theta/180*pI);
    printf("%f %f",x,y);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41942851/article/details/80240743
今日推荐