36. Compare Register Values

 The class Register8 is already defined with a private variable value, a constructor, and a getter.

Your task is to define the == operator so that two Register8 objects can be compared.

  • If both registers hold the same value, return true.
  • Otherwise, return false.
     

In main()we are doing:

  • Read two integers.
  • Create two Register8 objects.
  • Compare them using ==.
     

Print:

Equal

 or

Not Equal

 

Example
 Input:

10 10

Output:

Equal

 

Input:

5 7

Output:

Not Equal
Loading...

Input

10 10

Expected Output

Equal