Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<conio.h>
- #include<math.h>
- #define G_CONST 9.81
- //---------------------------------------------------------------------
- float Height(float deg, float time, float V)
- {
- float Vy;
- deg = (deg *3.14)/180;
- Vy = V*sin(deg);
- float height = Vy*time - G_CONST*(time*time) / 2;
- return height;
- }
- //---------------------------------------------------------------------
- float horizontal(float deg, float time, float V)
- {
- float Vx;
- deg = (deg *3.14) / 180;
- Vx = V*cos(deg);
- float S = Vx*time;
- return S;
- }
- //---------------------------------------------------------------------
- int main()
- {
- int i = 1;
- while (1)
- {
- float V;
- int deg;
- float height = 0.0;
- float distance = 0.0;
- float time = 0.1;
- printf("Enter v (0.0-100.0 m/s and a (0-90) degress): ");
- scanf("%f %d", &V, °);
- if (deg > 90 || deg < 0)
- {
- printf("\n wrong angle!");
- }
- if (V > 100 || V < 0)
- {
- printf("\n wrong speed!");
- }
- while (height >= 0)
- {
- height = Height(deg, time, V);
- distance = horizontal(deg, time, V);
- printf("Time:%f S=%f H=%f\n", time, distance, height);
- time += 0.1;
- }
- _getch();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement