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

PROGRAMMING:3.9 - use the ternary operator to determine whether the two numbers entered are equal

Luz5年前 (2021-05-10)题库536
Replace the if in the program in listing 3-6 with the conditional operator (trinomial operator) to achieve the same function.
Listing 3-6 requires: are the two integers entered equal?
The operation of exercises 3-9 is as follows:
```
Please enter two integers.
Integer 1: - 5
Integer 2: - 5
They are equal.
```
```
Please enter two integers.
Integer 1:40
Integer 2:45
They are not equal.
```
###Input example:
```in
-5
-5
```
###Output example:
```out
Please enter two integers.
Integer 1: integer 2: they are equal.
```







answer:If there is no answer, please comment