Click here to Skip to main content
15,886,777 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C++
#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");
}
Posted
Updated 22-May-15 19:11pm
v3
Comments
chandanadhikari 29-May-15 8:06am    
free and open source :: http://koolplot.codecutter.org/
maybe it can help you !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900