fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4.  
  5. int main()
  6. {
  7. int x=60; //x is the measure of angle in degrees.
  8. int V= 144; //Initial velocity
  9. double t= 0.5; //Seconds
  10. double h; // height
  11.  
  12.  
  13. std::cout << "Time" << '\t'
  14. << "Height" << std::endl;
  15. while(t<=8.0)
  16. {
  17. h = V*t*sin(x*M_PI/180)- 16*t*t;
  18. std::cout << t << '\t' << h << std::endl;
  19. t += 0.5;
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
Time	Height
0.5	58.3538
1	108.708
1.5	151.061
2	185.415
2.5	211.769
3	230.123
3.5	240.477
4	242.831
4.5	237.184
5	223.538
5.5	201.892
6	172.246
6.5	134.6
7	88.9536
7.5	35.3074
8	-26.3387