emaansahmed

Assignment #2 Pt. 1

Jan 26th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main(void)
  7. {
  8. char key = 0;
  9. float distanceAB = 0, distanceAC = 0, distanceBC = 0;
  10.  
  11. cout << "Enter distance between Phoenix, AZ and Salt Lake City, UT:" << endl;
  12. cin >> distanceAB;
  13. cout << "Enter distance between Phoenix, AZ and Atlanta, GA:" << endl;
  14. cin >> distanceBC;
  15.  
  16. distanceAC = sqrt(pow(distanceAB, 2) + pow(distanceBC, 2));
  17.  
  18. cout << "Distance between Salt Lake City, UT & Atlanta, GA is " << distanceAC << endl;
  19. cin >> key;
  20.  
  21. return 0;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment