早教吧 育儿知识 作业答案 考试题库 百科 知识分享

设计一个复数类.从键盘输入2个复数,完成复数的加减运算,然后输出运算结果.structcomplex{\x05doublereal;\x05doubleimaginary;};structcomplexinput(void){}structcomplexplus(structcomplexa,structcomplexb){}structcomp

题目详情
设计一个复数类.从键盘输入2个复数,完成复数的加减运算,然后输出运算结果.
struct complex
{
\x05double real;
\x05double imaginary;
};
struct complex input(void)
{
}
struct complex plus(struct complex a,struct complex b)
{
}
struct complex minus(struct complex a,struct complex b)
{
}
void output(struct complex a)
{
}
int main()
{
}
▼优质解答
答案和解析
#include struct complex{double real;double imaginary;};struct complex input(void){struct complex num;printf("input complex number (eg.2.0+1.1i):");scanf("%lf+%lfi",&num.real,&num.imaginary);return num...
看了设计一个复数类.从键盘输入2个...的网友还看了以下: