#include <bits/stdc++.h>
using namespace std;
//a + jb 转换 |A|φ的公式
//确定公式 |A| = 根号下a*a + b*b; φ = arctanb/a;
void swap1(double c, double d)
{
double b,e;
e = c * c + d * d;//定义变量e等于|A|的平方
cout << pow(e,0.5) << endl;
const double PI = 3.14159265;
b = atan(d /c) * 180 / PI;//计算φ
cout << b << endl;
}
//|A|φ 转换 a + jb 的公式
//确定公式,a = |A| * cosφ; b = |A| * sinφ;
void swap2(double a, double b)
{
double c,d,e;
e = (b / 180) * 3.1415 ;
c = a * cos(e);//计算a
d = a * sin(e);//计算b
cout << c << endl;
cout << d << endl;
}
int main()
{
swap1();//相量代数式转换相量极坐标式
swap2();//相量极坐标式转换相量代数式
return 0;
}