-->
当前位置:首页 > 题库

PROGRAMMING:Addition, subtraction, multiplication and division operators

Luz5年前 (2021-05-10)题库427
The main functions are as follows: 1. Add, subtract, multiply and divide two complex numbers (C1 and C2); 2. Add, subtract, multiply and divide complex numbers C1 and integer num; 3. Add, subtract, multiply and divide integer num and complex numbers C1
###Input format:
C1 real part C1 imaginary part C2 real part C2 imaginary part integer num see the example for the specific format.
###Output format:
C1 + C2 results C1-C2 results C1C2 results C1 / C2 results C1 + num results C1 num results C1 num results C1 / num results num + C1 results num-c1 results num * C1 results num / C1 results the specific format is shown in the output example
###Input example:
Here is a set of inputs. For example:
```in
1.0 2.0
3.0 4.0
five
```
###Output example:
The corresponding output is given here. For example:
```out
c1+c2=(4.00,6.00i)
c1-c2=(-2.00,-2.00i)
c1*c2=(-5.00,10.00i)
c1/c2=(0.44,0.08i)
c1+num=(6.00,2.00i)
c1-num=(-4.00,2.00i)
c1*num=(5.00,10.00i)
c1/num=(0.20,0.40i)
num+c1=(6.00,2.00i)
num-c1=(4.00,-2.00i)
num*c1=(5.00,10.00i)
num/c1=(1.00,-2.00i)
```







answer:If there is no answer, please comment