用C语言编写程序,用结构体的方法进行两个复数的相减
答案:3 悬赏:80 手机版
解决时间 2021-01-17 22:23
- 提问者网友:缘字诀
- 2021-01-17 11:28
用C语言编写程序,用结构体的方法进行两个复数的相减
最佳答案
- 五星知识达人网友:归鹤鸣
- 2021-01-17 11:46
#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
",c.m_r,c.m_i);
}
全部回答
- 1楼网友:洎扰庸人
- 2021-01-17 12:58
#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 ",c.m_r,c.m_i);
}
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 ",c.m_r,c.m_i);
}
- 2楼网友:鸽屿
- 2021-01-17 12:27
填写如下
c.m_r = c1.m_r - c2.m_r;
c.m_i = c1.m_i - c2.m_i;
得到的答案是c = 1+i2
c.m_r = c1.m_r - c2.m_r;
c.m_i = c1.m_i - c2.m_i;
得到的答案是c = 1+i2
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯