Projectile C++ and OpenGL

Code:

`void Update(float dt) `

{

Vector3 acceleration;

Vector3 Vi, Vf, W;

Vi.set(5, 20, 10);

Vf.set(400, 200, -900);

acceleration.set(0, -32.2, 0); // acceleration (x,y,z)=(0,-2,0)

vel = Add(vel, acceleration); //velocity = velocity + acceleration

vel.scale(dt); //velocity = velocity +a*dt

W = Add(Vf, Vi); //position = position + (1/2)*(v_f +v_i)*dt

pos = Add(pos, W); //updates position = position + vel

pos.scale(0.5); //This multiplies pos by 0.5, i.e. W = 0.5 * W

pos.scale(dt);

}

I'm working on a cannon that shoots a cannon ball in OpenGL. I get the ball to move in a line but no arc. The ball is suppose to shoot up and come back down. The two formulas I have to use are:

velocity = velocity +a*dt

position = position + (1/2)*(v_f +v_i)*dt

(Note: try not to use 1/2 in C++, but rather use 0.5)

You will use -32.2 for the second component of acceleration.

In my code above I can't figure out why I don't have the ball going in parabolic form. So basically I just need some tips on the position formula. I'm basically confused with the formula and how it's suppose to do the parabolic. It looks like the code has everything in the formula but not sure if I'm taking the correct steps in the formula. If some one could break down the formula step by step that would be awesome!

Do you add the position to (.5) then * (v_f + v_i) * (dt)?