// prints the position of a body moving with a uniformly accelerated motion // every deltaT seconds for n times. #include using std::cout; using std::cin; using std::endl; int main() { cout << " Print the position of a body moving with a uniformly accelerated " << endl; cout << " motion every deltaT seconds for n times" << endl << endl; cout << " Give me acceleration, velocity and x0 "; double a, v0, x0; cin >> a >> v0 >> x0; cout << " How many times do you want to print the position ? "; int n; cin >> n; cout << " Delta T ? "; int deltaT; cin >> deltaT; cout << endl; double x, t; for (int i = 0; i <= n; i++) { t = deltaT * i; x = 0.5 * a * t * t + v0 * t + x0; cout << " x(t): " << x << " t= " << t << " seconds " << endl; } return 0; }