Hopefully all yours doubt will clear if you have left with any doubt please let me know in comment. I will try my best to resolve that.
Here I am posting code and screenshot of output.
Code :-
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
// variable declaration
double height, weight = 58.5;
// initializing counter with zero
int count = 0;
// enter initial height
cout<<"Enter initial height of ball : "<<endl;
cin>>height;
// flatten to ground means in general is when height is less then
0.000001 cm you can change it according to your need.
while (height >= 0.000001)
{
// increment in count i.e. bounce
count++;
// new height after bounce ( weakens e^(-2) of height )
height *= exp(-2);
}
// print result
cout<<"ball will bounce " <<count<<" times before
flatten to ground"<<endl;
}
Screenshot of output :-

Tens Assume a tennis ball weighing 58.5 grams is bouncing strong initially and then weakens slowly...