1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
// Partical Motion Simulation
// Alex Wild
// Engr 21
// 9/19/2011
// This program will show the acceleration, velocity, and drag for a particular object for the first five seconds.
// Psuedocode
// 1. Declare Variables
// 2. Input equations for drag, velocity, and acceleration
// 3. Present drag, velocity, and acceleration
// 4. Hold window open
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
// 1. Declare Variables
int v, a, d;
const float t = 1;
char f;
// 2. Input equations for drag, velocity, and acceleration
v = (0.07*pow(t,3)) - (0.627*pow(t,2)) + (0.266*t) + 121.3;
a = (0.013*pow(t,2)) - (1.954*t) + 1.266;
d = (0.866*pow(t,4)) + (sin(3(t))) + (cos(t)*cos(t));
// 3. Present drag, velocity, and acceleration
cout << "At t=1:" << endl;
cout << "Velocity Is:" ;
cout << v << endl;
cout << "Acceleration Is:" ;
cout << a << endl;
cout << "Drag Is:" ;
cout << d << endl;
// 4. Hold window open
cin >> f;
return 0;
}
|