Question: Construct a C++ program that determines the position of the hour and minute hands of an analog clock at a moment in time. Using a

Construct a C++ program that determines the position of the hour and minute hands of an analog clock at a moment in time. Using a 12-hour clock (where the hour hand moves between the integers 1 thru 12 and the minute hand moves between the integers 0 and 59), read the current clock time from the user and then read a time increment to add to the current time. For this second time, calculate where the location of the hour and minute hand will be. Please include at least one const int declaration. Your program should allow the user to repeat this calculation as often as the user wishes.

The following is a sample program(User input is in bold) :

Enter the current hour (1-12): 1

Enter the current minute (0-59): 10 Enter the desired time increment (in minutes): 6 Based on these values, the hour hand will be at 1 and the minute hand will be at 16

Enter the current hour (1-12): 10 Enter the current minute (0-59): 20 Enter the desired time increment (in minutes): -50 Based on these values, the hour hand will be at 9 and the minute hand will be at 30 Enter the current hour (1-12): 12 Enter the current minute (0-59): 50 Enter the desired time increment (in minutes): 50 Based on these values, the hour hand will be at 1 and the minute hand will be at 40

Please write an explanatory comment after each line of code, thank you in advance.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!