#include using namespace std; // Code to calculate the distance // an object falls every second. int main(){ double y = 1000; // starting height double v = 0; // starting velocity double a = -9.8; // acceleration 9.8m/s^2 int t = 0; // elapsed time cout << "Before loop: " << y << endl; while(y > 0){ cout <<"Seconds: " << t; cout <<" Height: " << y << " Veloctiy: " << v << endl; v = v + a; y = y + v; t = t + 1; // one second later } cout <<"Seconds: " << t; cout <<" Height: " << y << " Veloctiy: " << v << endl; }