I am trying to write code for my friend to help him with a timed race to get on a college football team. I have the the "Stop watch" section working but what i am struggling with the given segments of the race. Each segment is a different length with 6 total segments all of which has to be under a total time. I have broken up each segment with how much time each segment should take.
The problem I am having is I need to record each segments time and how much over or under it is to the required pace. Should I use a for loop to count segments and if so how can I record time and time it should take him for each segment which is a different length. Could I use an array? I feel like I am getting closer to the solution. I just need a little help. Should I just keep the stop watch under a seperate function aand call function for each segment?
Is is active - we have a brand new and shiny articles section after all ^^
If you have to record a load of values of the same type then an array would seem a reasonable choice. Or perhaps std::vector for easy dynamic length.
As for recording time, you might want the time(), or clock() functions, both in the ctime header. http://cplusplus.com/reference/clibrary/ctime/
You can compute the differences between times too.