C++ (Borland builder 4) question

  • Context: C/C++ 
  • Thread starter Thread starter Techcom_dude
  • Start date Start date
  • Tags Tags
    C++
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
Techcom_dude
Messages
1
Reaction score
0
Hello

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

thanks
 
Physics news on Phys.org
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.