#include <iostream> using namespace std; int main () { double dt = 0.10; //(it is constant) double t = 0.00; double dx = 0.10; //(it is constant) double x = 0.00; double ddy = 1.00; //(it is constant) double dy = 0.00; double y = 1.00; cout<<"t = "<<t<<endl; cout<<"dx = "<<dx<<endl; cout<<"x = "<<x<<endl; cout<<"dy = "<<dy<<endl; cout<<"y = "<<y<<endl; cout<<endl; while(t<=5) { x = x + dx*dt; dy = dy - ddy * dt * dt; y = y + dy * dt; if (y<=-1) { y = -y; dy = -dy * 0.70; } t = t + dt; cout<<"t = "<<t<<endl; cout<<"dx = "<<dx<<endl; cout<<"x = "<<x<<endl; cout<<"dy = "<<dy<<endl; cout<<"y = "<<y<<endl; cout<<endl; } system("pause"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)