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

PROGRAMMING:Overload the greater than sign operator to compare the size of complex numbers

Luz5年前 (2021-05-10)题库404
The function of the code is as follows:
Input two complex numbers (variable name self generated), compare the size of the complex modulus, the real part and imaginary part of the complex are integers
Four integers are required to represent the real part and imaginary part of complex number 1, and the real part and imaginary part of complex number 2
###Input format:
Enter four integers in the same line to represent the real part and imaginary part of complex number 1 and the real part and imaginary part of complex number 2 respectively
###Output format:
The output compares the size of two complex modules
When complex 1 modulus is greater than complex 2, output 1
When complex 1 modulus is less than complex 2, output - 1
When complex modulus 1 equals complex modulus 2, output 0
###Input example:
For example, when the complex number 1 is 12 + 34i and the complex number 2 is 58 + 59i, the format is as follows
```in
12 34 58 59
```
###Output example:
The modulus of complex number 1 is smaller than that of complex number 2, so output - 1
```out
-1
```







answer:If there is no answer, please comment