A bit of help with programming, anyone?

Howard

Lifer
Oct 14, 1999
47,982
11
81
I've got this program, and... Well, first I'll just let you see it.

prog

Run it, enter: 'n', 50

See the lines of output? I want all the t values to be whole (not int, just so that they end with zeroes). How can this be accomplished? (t = 0.00, t = 1.00, t = 2.00, t = 3.01, t = 4.01, t = x.01) :(

I tried so many methods. :(

EDIT: The last one of t, x, and y are supposed to be the data when t is the last interval such that y is still above ground, so it doesn't matter if t isn't a whole number for the last line of data output.
 

Howard

Lifer
Oct 14, 1999
47,982
11
81
Originally posted by: mugs
Wrong forum and I didn't run it or look through it too thoroughly , but are you typecasting the input to a double?
Which input?
 

Howard

Lifer
Oct 14, 1999
47,982
11
81
I got it... I used this line:

if (t - floor(t) > 0.995 &amp;&amp; t - floor(t) < 1.005 || t - floor(t) == 0)

It's ridiculous. If I change the original line from:

if ((int)(t * 100) % 100 == 0)

to

if ((int)(t * 1000) % 1000 == 0)

I don't get the x.01 t values anymore. I just get t = 0.00, t = 1.00, t = 2.01.

I'm sure glad it's over. :)

EDIT: Where is the hell is the Attach Code button?