main.cpp

#include <iostream>
float distance(float x);
void printdistance();

int main()
{

printdistance();
return 0;

}
constants.h

#ifndef CONSTANTS_H_INCLUDED

#define CONSTANTS_H_INCLUDED
namespace constants
{
const double gravity_constant(9.8);

}

#endif // CONSTANTS_H_INCLUDED

distance.cpp

#include <iostream>

#include “constants.h”

float distance(float h,float x)
{
using namespace std;
float fallen;
fallen = h - constants::gravity_constant (xx / 2);
if (fallen< 0)
return false;
else
return fallen;
}

void printdistance()
{
using namespace std;
cout << “please input the height of the ball : “<< endl;
float h;
cin >> h;
float zero = distance(h,0);
float one = distance(h,1);
float two = distance(h,2);
float three = distance(h,3);
float four = distance(h,4);

cout << “At 0 seconds, the ball is at height: “<< zero << “ meters . “ <<endl;
cout << “At 1 seconds, the ball is at height: “<< one << “ meters . “ <<endl;
cout << “At 2 seconds, the ball is at height: “<< two << “ meters . “ <<endl;
cout << “At 3 seconds, the ball is at height: “<< three << “ meters . “ <<endl;
cout << “At 4 seconds, the ball is at height: “<< four << “ meters . “ <<endl;
cout << “At 5 seconds, the ball is at height: 0 meters . “ <<endl;
}