用C语言编写程序,用结构体的方法进行两个复数的相减
#include<stdio.h>structComplex{doublem_r;doublem_i;};voidmain(){structComplexc1={1.2,...
#include <stdio.h>
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;
???
???
printf("c=%g+i%g\n",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;
???
???
printf("c=%g+i%g\n",c.m_r,c.m_i);
}
请问?处应该怎么填。。。 展开
3个回答
展开全部
/*
c = 1+i2
Press any key to continue
*/
#include <stdio.h>
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 <stdio.h>
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
c.m_r = c1.m_r - c2.m_r;
c.m_i = c1.m_i - c2.m_i;
得到的答案是c = 1+i2
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询