Question:I am not able to start the codes of project in c++.
Your clock has gone dead because you forgot to wind it or replace the battery, or you had a power outage. This clock has hands, so you must turn them to adjust the time. Which way, and how far, should you turn the hands to fix the time the most quickly?
You've probably guessed that this will be the easy one of the bunch. In fact, we'll trivialize it even further. The clock only has an hour hand, so the question becomes how many whole hours backwards or forwards the hour hand must be moved. Then we will "complicate" it a bit by turning it into a general modulo-n counting problem, by saying that the clock displays n hours on its face.
The algorithm is
The interesting thing about these problems is that we do not have to think about the concrete problem instance in order to describe an algorithm to solve it! Read and make sure you understand the algorithm below:
Create an initially empty queue of configurations.
Insert the initial configuration into the queue.
the queue is not empty and
the first configuration in the queue does not meet the goal,
Remove the first configuration from the queue and call it cfg.
For each move applicable to cfg, loop:
Make the move and enqueue the resulting
configuration if it has not already been seen.
The acceptable configuration is now at the head of the queue;
but if the queue is empty, there is no solution to the problem.