Modify the operator and by inference the binary operator


Question: a. Modify the += operator (and by inference the binary + operator) to detect overflow. To do so, change the internal representation to an unsigned int, and store a sign bit separately. Print a warning message if an overflow is detected (or throw an exception if you can).

b. Modify the -= operator to detect overflow.

c. Modify the / = operator to detect division by 0.

d. Modify the unary minus operator to detect overflow (there is only one case wherein this happens).

e. Modify the bit shift operators to print an illegal message if the second parameter is either negative or not smaller than the number of bits in an unsigned int.

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Modify the operator and by inference the binary operator
Reference No:- TGS02475070

Now Priced at $15 (50% Discount)

Recommended (98%)

Rated (4.3/5)