Hi everybody,
I am not new to c++ but am far from a intermediate. I would appreciate any help or suggestions. However, my problem is I need to store dynamic data into different variables. For example time. I am trying to write an if statement that would take time store it in t1 and then when my function time gets called .05 seconds later it will take time and store it in t2 without changing t1.
I know this is simple but I cannot seem to get it. Below is my code. This is my inefficient way of coding it. It should work but for some reason even if I do a cout my t1 will change with time even though it is suppose to stop at .8 seconds.
if(tm<0)
{return;}
if(time>0, time<.8)
{t1=time; y1=position;}
if(time>.1, time<.15)
{t2=time; y2=position;}
if(time>.2, time<.25)
{t3=time; y3=position;}
Like I said I am fairly new, but would an array work better here. If so can I take the values of an array and assign each data box to a variable?