/*
c = 1+i2
Press any key to continue
*/
#include
struct Complex {
double m_r;
double m_i;
};
void main() {
struct Complex c1 = {1.2,2.3},c2 = {0.2,0.3};
struct Complex c;
c.m_r = c1.m_r - c2.m_r;
c.m_i = c1.m_i - c2.m_i;
printf("c = %g+i%g\n",c.m_r,c.m_i);
}
#include
struct Complex
{
double m_r;
double m_i;
};
void main()
{
struct Complex c1={1.2,2.3},c2={0.2,0.3};
struct Complex c;
c.m_r=c1.m_r+c2.m_r;
c.m_i=c1.m_i+c2.m_i;
printf("c=%g+i%g\n",c.m_r,c.m_i);
}
填写如下
c.m_r = c1.m_r - c2.m_r;
c.m_i = c1.m_i - c2.m_i;
得到的答案是c = 1+i2