#include #include #include using namespace std; /* HAD calc accel store vel update pos update vel print cur data repeat */ int main(int argc, char **argv){ double a, k = 1, m = 1, t = 0, dt = .001, v = 0, vp, x = 1, xp; while(t<10){ t += dt; a = vp = ((-k)/m)*x; xp = v; x = (vp *dt); v += a; cout << "t: " << t << "\tv: " << v << "\tvp: " << vp << "\tx: " << x << "\txp: " << xp << endl; } cout << "Answer: " << x << endl; return 0; }