Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C++ (Borland builder 4) question

  1. Oct 20, 2008 #1

    I just read a thread in the physics forums (it might be out of date) but it is about a 2d orbit simulation and I am trying to do the same thing my question is not about the physics or the math but instead how do I use the timer in Borland Buidler 4 C++?

    my plan is this I start with a big yellow circle in the middle and a little blue circle next to it and I want the blue one to move around the yellow one. I am doing this is a cheap way first the blue circle has it's initial position and then I am going to calculate it's new position and move it by first drawing another circle at that position that is the same color as that back ground and then redraw the blue one at the new positions and do it over and over.

    I just don't know how to use the timer

  2. jcsd
  3. Oct 20, 2008 #2


    User Avatar

  4. Oct 25, 2008 #3
    I use Borland C/C++ but not the builder. I expect the libraries to be reasonably close.
    Try difftime(t1,t2) which returns the difference in time as a double.
    t1 and t2 can be registered at different times using time().
    difftime and time are both ANSI functions, so should present no problem.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook