/* bouncingBall.cpp calculates and displays the rebound heights 
 * of a dropped ball.
 *
 * Input:  a real height from which a ball is dropped.
 * Output: for each rebound of the ball from the pavement below:
 *            the number of the rebound and
 *            the height of that rebound
 *         assuming that the height of each rebound 
 *         is one-half the previous height
 ****************************************************************/

#include <iostream>                   // <<, >>, cout, cin
using namespace std;

int main()
{
  const double SMALL_NUMBER = 1.0e-3;    // 1 millimeter

  cout << "This program computes the number and height\n"
       << "of the rebounds of a dropped ball.\n";

  cout << "\nEnter the starting height (in meters): ";
  double height;
  cin >> height;

  cout << "\nStarting height: " << height << " meters\n";

  int bounce = 0;
  while (height >= SMALL_NUMBER)
  {
     height /= 2.0;
     bounce++;
     cout << "Rebound # " << bounce << ": "
          << height << " meters" << endl;
  }



  return 0;
}
