Guest User

Untitled

a guest
Jan 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <string.h>
  4. #include <cstdlib>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10. int time = 0;
  11. int distance = 0;
  12. double velocity = 0;
  13. string operation;
  14.  
  15. cout << "Are you finding velocity, time, or distance?" << endl;
  16. cin >> operation;
  17.  
  18. if (operation == "velocity")
  19. {
  20. cout << "What is the time?" << endl;
  21. cin >> time;
  22. cout << "What is the distance?" << endl;
  23. cin >> distance;
  24. velocity = distance/time;
  25. cout << "The answer is " << velocity << endl;
  26. }
  27. else if(operation == "time")
  28. {
  29. cout << "What is the distance?" << endl;
  30. cin >> distance;
  31. cout << "What is the velocity?" << endl;
  32. cin >> velocity;
  33. time = distance/velocity;
  34. cout << "The answer is " << time << endl;
  35. }
  36. else if(operation == "distance")
  37. {
  38. cout << "What is the time?" << endl;
  39. cin >> time;
  40. cout << "What is the velocity?" << endl;
  41. cin >> velocity;
  42. distance = time*velocity;
  43. cout << "The answer is " << distance << endl;
  44. }
  45. else
  46. {
  47. cout << "Fine be an asshole, see if I care" << endl;
  48. }
  49.  
  50.  
  51. system("PAUSE");
  52. return 0;
  53. }
Add Comment
Please, Sign In to add comment