(General math) a. A balance has the following weights: 100 lb, 50 lb, 10 lb, 5 lb, and 1 lb. The…
(General math) a. A balance has the following weights: 100 lb, 50 lb, 10 lb, 5 lb, and 1 lb. The number of 100 lb and 50 lb weights required to weigh an object weighing WEIGHT pounds can be calculated by using the following C++ statements:
Using these statements as a starting point, write a C++ program that calculates the number of each type of weight needed to weigh a 789 lb object.
b. Without compiling or running your program, manually check the effect of each statement in the program and determine what’s stored in each variable as each statement is encountered.
c. After verifying that your algorithm works correctly, compile and run your program. Verify that the results your program produces are correct. After verifying that your program is working correctly, use it to determine the weights required to weigh a 626 lb object.