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

PROGRAMMING:Binary bit operation in Java

Luz5年前 (2021-05-10)题库368
This topic requires reading in 2 integers and a character, and then according to the value of the character, the corresponding binary bit operation on the two integers. The * * switch must be used to select the structure * *.
(1) If the character is & then * * and * * of binary bits are performed on two integers;
(2) If the character is |, two integers are used for binary bit * * or operation * *;
(3) If the character is ^, the binary bit exclusive or operation is performed on two integers;
(4) If it is other characters, the fixed output information is error
###Input format:
Enter integer 1, character and integer 2 in one line.
###Output format:
Similar to 3 & 4 = 0
There is a space before and after the operation symbol & and there is a space before and after the equal sign.
The above shows that 3 and 4 do binary and operation, and the result is 0.
###Input example:
The binary of 3 is 0011, the binary of 4 is 0100, and the result of the two and operation is 0.
```in
3 & 4
```
###Output example:
Note that before and after & and = are * * with and only * * a space.
```out
3 & 4 = 0
```
###Input example:
```in
7 X 3
```
###Output example:
```out
ERROR
```






answer:If there is no answer, please comment