Counting Issue_ need program to count, format and enter data.

#include<iostream>
#include <cmath>
#include <iomanip>

using namespace std;


double VelocityCalculation(double initialVelocity, double time)
{

double pow(double,double);
const double GRAVITY = -32.0;
return GRAVITY*time + initialVelocity;
}


double PositonCalculation ( double begin, double speed,double time, double position)
{
const double calculation =1;

return calculation * begin +speed *time + position;



}


int main()
{

int count;
const double POSITIVE_HEIGHT = 1000;
const double VELOCITY_LIMIT = -500;
const double SUBTRACT = 500;
double Velocity_Equation ;
double const TALL =-16;
double start;
double height;
double velocity;
double velocity_answer;
double position_answer;
double moment;
double position;
double Squared;


cout << endl;
cout <<" Program will calculate the position and velocity of a falling object. ";
cout << endl << endl <<endl;
cout <<" Enter the initial height in feet (above 1000): ";
cin >> height;
cout << endl;

while ( height < POSITIVE_HEIGHT )

{ cout << " Invalid answer. Must enter height over 1000:" << endl;
cout << " Enter the initial height in feet (above 1000): ";
cin >> height;
cout << endl; }

cout <<" Enter the intial velocity in ft/sec: ";
cin >> velocity;
cout << endl;

while ( velocity < VELOCITY_LIMIT )
{ cout << " Invalid answer. Must enter velocity over -500: " << endl;
cout << " Enter the velocity above -500): ";
cin >> velocity;
cout << endl;
}

count = 0;
do
{
cout << fixed << setprecision(0) << setw(4) << moment << setprecision(2);
cout << setw(18) << setprecision(2) << position_answer << setw(16) << velocity << endl;

moment++;
} while (count >=20);

Squared = moment * moment;
start = TALL * Squared;
do
{

velocity = VelocityCalculation (velocity,moment);
if(velocity < VELOCITY_LIMIT)
{position_answer = position_answer-SUBTRACT;
velocity= VELOCITY_LIMIT;}
else if(velocity > VELOCITY_LIMIT)
{position_answer = PositonCalculation (start,moment,velocity,height);
moment = moment + 1;}
}while (position >= 1000);





cout<<endl<<endl;
cout << " Press [enter] to exit" <<endl;
cin.ignore(); //needed because of keyboard input
cin.get();
return 0;
}
Please use [code][/code] tags and ask something more specific
http://www.cplusplus.com/forum/articles/1295/
Topic archived. No new replies allowed.