Advertisement
ptrawt

259201 Lab10.3

Nov 4th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. float myDistance(float u,float a,float t);
  7. float myVelocity(float u,float a,float s);
  8.  
  9. int main()
  10. {
  11.     float u = 20,a = 3, t = 5;
  12.     cout<<"Distance of this car is "<<myDistance(u,a,t)<<endl;
  13.     cout<<"Velocity of this car after passed 5 seconds is "<<myVelocity(u,a,myDistance(u,a,t));
  14. }
  15.  
  16. float myDistance(float u,float a,float t)
  17. {
  18.     return (u*t)+(0.5*a*pow(t,2));
  19. }
  20.  
  21. float myVelocity(float u,float a,float s)
  22. {
  23.     return sqrt(pow(u,2)+(2*a*s));
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement