timers

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?

Thanks for all your help
thanks alot for all the replies.....i see this is a very active forum....looks like everyone is stuck in sleep mode. f u very much :(
lol @ only giving us 3 hours and then insulting us.
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.
thanks....used nested ifs..........you are quick to reply when someone shouts but not initially to the post.....point proven.....code works...bye
what a choad.

What'd you help him for, xander? =P
Well at least I learnt a new word, albeit one I doubt I'll use very often.
Topic archived. No new replies allowed.