Click here to Skip to main content
14,664,481 members
Rate this:
Please Sign up or sign in to vote.
See more:
#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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100