View Single Post
  #13   Spotlight this post!  
Unread 16-12-2006, 10:24
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Re: Rounding numbers

Quote:
Originally Posted by Alan Anderson View Post
I believe you have declared the wrong variable as static. The way it stands now, i will be set to 1 then incremented to 2 each time through the loop, and time_i will always be computed as 0. If you change it to say
Code:
static int i = 1;
int time_i;
instead, i will remember its value between loops and be incremented as desired, and time_i will do as neilsonster said...

...at least until 125 loops have occurred, after a bit more than 3.25 seconds, after which time (i * 262) will overflow and you'll start getting negative results.
Ok kool, i'll just switch that now
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source