Advertisement
Guest User

really simple code with wrong results

a guest
Sep 21st, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. using namespace std;
  4.  
  5. double calcAcceleration(double theta);
  6.  
  7. int main()
  8. {
  9.     double theta=23.5;
  10.     cout<<"A child on a sleigh is travelling down a frictionless hill with a slope of 23.5 degrees, it is accelerating at a constant rate of: ";
  11.     cout<<calcAcceleration(theta);
  12.     cout<<"m/s^2.\n";
  13.     cout<<"Let's hope that isn't a very high hill.\n";
  14.     return 0;
  15. }
  16.  
  17. double calcAcceleration(double theta)
  18. {
  19.     double radians = theta/180;
  20.     double a = (9.8*(sin(radians)));
  21.     return a;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement