-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathProjectile.cpp
More file actions
executable file
·28 lines (27 loc) · 998 Bytes
/
Copy pathProjectile.cpp
File metadata and controls
executable file
·28 lines (27 loc) · 998 Bytes
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
#include <iostream>
#include <stdlib.h>
#include <math.h>
int main()
{
std::cout<<"hello goodmorning :)"<<std::endl; // In modern C++, cout lives in the std namespace
int num; //random_first_number
int initial_velocity; //initial_velocity
int time; //time
int angle; //angle
float g = 9.8;
float double ; //degrees_to_radians
std::cout<<"Enter a number :";
std::cin>>num;
std::cout<<"The number you entered was "<<std::endl;
std::cout<<" PROJECTILE "<<std::endl;
std::cout<<"Calculate Range-"<<std::endl;
std::cout<<"Enter initial velocity of the projectile(m/s):";
std::cin>>initial_velocity;
std::cout<<"Enter the total time of the projectile before it touches the ground(seconds):";
std::cin>>time;
std::cout<<"Enter the angle made with the ground(degrees):";
std::cin>>angle;
std::cout<<"Range of the projectile is :";
std::cout<<(int(initial_velocity) * int(initial_velocity) * sin(int(angle)) / float(g));
return 0;
}