Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago