C语言写的计算器中如何加入复数的运算?只能计算实数的加减乘除 怎么加入复数的运算#include double add(double a,double b){ double s; s=a+b; return s;}double sub(double a,double b){ double s; s=a-b; return s;}double mult
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/11 21:16:45
C语言写的计算器中如何加入复数的运算?只能计算实数的加减乘除 怎么加入复数的运算#include double add(double a,double b){ double s; s=a+b; return s;}double sub(double a,double b){ double s; s=a-b; return s;}double mult
C语言写的计算器中如何加入复数的运算?
只能计算实数的加减乘除 怎么加入复数的运算
#include double add(double a,double b){ double s; s=a+b; return s;}double sub(double a,double b){ double s; s=a-b; return s;}double multi(double a,double b){ double s; s=a*b; return s;}double div(double a,double b){ double s; s=a/b; return s;}void main(void){ double a,b; char c;int m; double sum; scanf("%lf%c%lf",&a,&c,&b); switch(c) { case '+':sum=add(a,b); break; case '-':sum=sub(a,b); break; case '*':sum=multi(a,b); break; case '/':sum=div(a,b); break;
default:printf("input is error!");
} printf("jg=%lf\n",sum); }
C语言写的计算器中如何加入复数的运算?只能计算实数的加减乘除 怎么加入复数的运算#include double add(double a,double b){ double s; s=a+b; return s;}double sub(double a,double b){ double s; s=a-b; return s;}double mult
实数和虚数分开计算