// Handout #1: Source code of a C++ Program, which

 

// converts distance in miles to kilometers.

 

 

 

#include <iostream>  //inclusion of support for doing input & output

 

using namespace std; //declare access to standard stuff like cin, cout

 

 

 

// Beginning of main function

 

int main()             

 

{

 

      // Declaration of three variables

 

      double KM_PER_MILE = 1.609;    // for storing a constant: 1.609 km equals a mile

 

      double miles;             // for storing the input data: distance in miles

 

      double kms;          // for storing the result: distance in kilometers

 

 

 

      // Get the input of distance in miles.

 

      cout << "What is the distance in miles?" << endl;

 

      cin >> miles;

 

      cout << "The distance in miles is " << miles << endl;

 

 

 

      // Convert the distance to kilometers and store the result.

 

      kms = KM_PER_MILE * miles;

 

 

 

      // Display the distance in kilometers.

 

      cout << "The distance in kilometers is " << kms << endl << endl;

 

 

 

 

     // Display a good-bye message

 

     cout << "It is a pleasure to do this mile-to-kilometer conversion for you." << endl;

 

     cout << "Please enter any charcter and a return to quit the program." << endl;

 

 

 

     // Wait for the user input before ending the program

     char inputCharacter;    // Declare a variable for storing a character input from the keyboard

     cin >>  inputCharacter; // Wait to read in a character input from the keyboard

 

 

     //Finish the program and return the control to the operating system.

return 0;

 

 

 

 

}

 

//End of the main function.