#include #include #define G 9.8 #define PI 3.14159 main() { float init_angle, v0, t1, delta_t; int N, i; float x, y, v_y, t, init_angle_rad; float v_x_0, v_y_0; clrscr(); printf("Initial Angle (degree) = ? "); scanf("%f", &init_angle); init_angle_rad = PI * init_angle / 180; printf("Initial Speed = ? "); scanf("%f", &v0); v_x_0 = v0 * cos(init_angle_rad); v_y_0 = v0 * sin(init_angle_rad); printf("Start time = ? "); scanf("%f", &t1); printf("Delta-Time = ? "); scanf("%f", &delta_t); printf("No. of Delta-Times = ? "); scanf("%d", &N); printf("\nTime X Y Vx Vy"); for (i = 0; i <= N; ++i) { t = t1 + i * delta_t; x = v_x_0 * t; y = v_y_0 * t - 0.5 * G * pow(t, 2); v_y = v_y_0 - G * t; printf("\n%-14f%-14f%-14f%-14f%-14f", t, x, y, v_x_0, v_y); } printf("\n\nPress any key to exit..."); getch(); }