首先讲一下三角形式的复数乘法

其次 13分的原因:

改了A(实部) 别忘改B(虚部)
C++代码
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main(){
double r1,p1,r2,p2,A,B;
cin>>r1>>p1>>r2>>p2;
A=r1*r2*(cos(p1)*cos(p2)-sin(p1)*sin(p2));
B=r1*r2*(cos(p1)*sin(p2)+sin(p1)*cos(p2));
if(A>=-0.005&&A<=0) printf("0.00");
else printf("%.2f",A);
if(B>=0) printf("+%.2fi",B);
else if(B>=-0.005&&B<=0) printf("+0.00i");
else printf("%.2fi",B);
return 0;
}
本文首先讲解三角形式的复数乘法规则,随后通过C++代码演示如何计算两个复数的乘积,包括实部和虚部的计算,并提供了一种精确到小数点后两位的输出方式。

1946

被折叠的 条评论
为什么被折叠?



