#include<iostream>
#include<math.h>
#define pi 3.1415926
using namespace std;
int main()
{
cout<<"请输入数字判断转化类型,0为度分秒转化成弧度,1为弧度转化成度分秒"<<endl;
int q;
cin>>q;
double x,y,z,a,b,c,d,e,f,n; //x为输入数值,a,b,c为转化后的度分秒,y为转化后的度,z为转化后的弧度
if(q=0)
{
cout<<"请输入度分秒"<<endl;
cin>>x;
a=(int)x;
d=100*(x-a);
e=100*x;
f=(int)e;
b=(int)d;
e=10000*x-100*f;
c=(int)e;
y=a+b/60+c/3600;
z=(y*pi)/180;
cout<<"度:"<<a<<endl;
cout<<"分:"<<b<<endl;
cout<<"秒:"<<c<<endl;
cout<<"度分秒转化为度:"<<y<<endl;
cout<<"弧度:"<<z<<endl;
}else
{cout<<"请输入弧度"<<endl;
int m=0;
cin>>m;
n=(m*180)/pi;
cout<<"转化后的度:"<<n<<endl;
}
system("pause");
return 0;
}
新手练习,勿喷