1. PF Contest - Win "Conquering the Physics GRE" book! Click Here to Enter
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Sounding rockets with c++

  1. Nov 16, 2009 #1
    Hi guys,

    I've got the following question :

    and he want's me to :
    I wrote the following code :
    I've solved part 1,2,4 .. but the problem is in part 3 which I don't understand what the question means (I tried by maximum and minimum the velocity and acceleration but I get the first time which is wrong ... now I need your help guys :)
    I've uploaded the data files (rocket3.txt) and the final results (how it should be)

    Attached Files:

    Last edited: Nov 17, 2009
  2. jcsd
  3. Nov 17, 2009 #2
    guys I've got an idea but I don't know how to do it ,,

    I wanna say when the acceleration goes from negative to positive record the time ,, but how can I say that in codes ??
  4. Nov 17, 2009 #3


    User Avatar

    Staff: Mentor

    Either remember sign of the last value in additional variable and go for (lastsignnegative && a > 0), or read all in the table and compare signs of neighboring values by something like (a < 0 && a[i+1] > 0). This is not bulletproof as if at some point a is zero you will probably miss it.
  5. Nov 17, 2009 #4
    thanks Borek, but I don't know how to assign (lastsignnegative) to the last negative value and in the second way how to assign it in my code ?? i mean how to assign it to values of a if a is the acceleration and you've typed a(i) write it as a(a) ??
    Last edited: Nov 18, 2009
  6. Nov 18, 2009 #5
    thanks borek ,, I've got you now :) ,, solved :D thanks again
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook