A program to convert (input) kilometers into miles.


SUBMITTED BY: Guest

DATE: Nov. 12, 2013, 2:54 a.m.

FORMAT: Text only

SIZE: 802 Bytes

HITS: 1145

  1. // A program to convert (input) kilometers into miles.
  2. // M. Cowan, September 10th, 2011
  3. #include <iostream>
  4. #include <cstdlib>
  5. using namespace std;
  6. int main()
  7. {
  8. // Declare and initialize variables.
  9. float k = 0;
  10. // Prompt user for input (in kilometers).
  11. cout << "Please input the number of kilometers you wish to be converted "
  12. "into miles."
  13. << endl << endl;
  14. cin >> k;
  15. // Display # of kilometers in miles.
  16. cout << endl
  17. << k << " kilometers is " << (k * 0.621371192) << " miles."
  18. << endl << endl;
  19. /* Pause the system so the program window does not close until user inputs
  20. * a key. */
  21. system("PAUSE");
  22. return EXIT_SUCCESS;
  23. }

comments powered by Disqus