Projectile motion simulation

hey guys I made a program about the projectile motion, so can you guys show me how to make the graphics simulation for that motion.
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
47
48
49
50
51
52
53
54
55
56
57
  
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;

const double PI = 3.141592654, g = -10;

int main()



{
    
    double launch_angle, Vo, Vx, Vy,time,x,y,y_max;
    
    
    do
    {
        
        cout << "Enter intial Velocity: \n";
        cin >> Vo;
        
    }while ((Vo < 0) || (Vo > 100));
    
    do
    {
        cout << "Enter Launch Angle: \n";
        cin >> launch_angle;
    }while ((launch_angle < 1) || (launch_angle > 89));
    
    Vx = Vo * cos (launch_angle*PI/180);
    Vy = Vo * sin (launch_angle*PI/180);
    
    cout<< "Vx = "<<Vx<<endl;
    cout<< "Vy = "<<Vy<<endl;
    
    do
    {
        cout << "Enter the time: \n";
        cin >> time;
    }while (time <0);
    
    y_max = (Vo * sin(launch_angle*PI/180)*Vo * sin(launch_angle*PI/180))/2*g;
    cout<<"Y max = "<<y_max<<endl;
   
    x = Vo * cos(launch_angle*PI/180) * time;
    y = (1/2) * g *time*time + Vo * sin(launch_angle*PI/180) * time;
    
    cout<< "x = "<<x<<endl;
    cout<< "y = "<<y<<endl;
    
   
        
    system("pause");
    return 0;
}
closed account (2UD8vCM9)
It's not that simple, sadly :/.

You should either look into learning DirectX or look into learning OpenGL if you're trying to do graphics.

If you're going to take the DirectX route, and you may be interested in DirectX 9, i'd reccommend checking out ChiliTomatoNoodle 's DirectX tutorials on youtube. Good luck.
Ok. thaks. I have to do that just using loop.
Last edited on
Topic archived. No new replies allowed.