Thanks,I''ve made a little VB program that fills in the blanks when I give it values

Its just that now I have another problem, I''ve got the car accelerating, but it tops at out 36km\h in 6th gear at 6500rpm?
My drag constants.
const float CDrag = 0.4257f;const float CFric = 12.8f;
(Ignore the corvette, its actually for the Audi S4) These are my car properties.
corvette.cartype.WheelBase = (float)4.4f; corvette.cartype.GearRatio[1] = 3.500f; corvette.cartype.GearRatio[2] = 1.889f; corvette.cartype.GearRatio[3] = 1.230f; corvette.cartype.GearRatio[4] = 0.967f; corvette.cartype.GearRatio[5] = 0.806f; corvette.cartype.GearRatio[6] = 0.684f; corvette.cartype.Diff = 4.4f; corvette.cartype.Mass = 2100; corvette.cartype.WheelRadius = 0.45f;
And my move car function:
int MoveCar(CAR &car, float delta){ float max_torque, engine_torque, drag, friction; max_torque = car.cartype.Torque[(int)car.rpm]; //Get max torque at a given RPM engine_torque = max_torque * (car.throttle / 100); //Multiply it by throttle position drive_force = engine_torque * car.cartype.GearRatio[(int)car.gear] * car.cartype.Diff * corvette.cartype.WheelRadius * 0.7f; //Calculate drive force drag = - CDrag * car.vel * ABS(car.vel); //Calculate Drag friction = - CFric * car.vel; //Calcualte Friction car.force = drive_force + drag + friction; //Find sum of forces acting on car car.accel = car.force / car.cartype.Mass; //F = m / a, to find acceleration car.vel = car.vel + car.accel * delta; //calculate car velocity using v = u + at car.rpm = ((car.vel / corvette.cartype.WheelRadius) * car.cartype.GearRatio[(int)car.gear] * car.cartype.Diff * 60) / 2 * (float)PI; //Workout RPM off new speed, for next set of calculations if (car.rpm < 1000) //Make sure RPM doesn''t go under engine idling RPM car.rpm = 1000; return 1;}
If anyone could point what is causing my car to top out at such a low speed it would be a great help.