OOPortal OOPortal
Programming C++  «Prev 

Adding Comments in C++ - Exercise

Objective:Add rest-of-line comments to as many lines of the following program as necessary to fully document the program's logic.


Use rest-of-line comments only. Assume that you are commenting for novice programmers who need as much information as possible to understand the program.

The program

#include <iostream.h>
   const int moon = 238857;
   cout << "The moon's distance from the Earth is "
    << moon;
   cout << " miles." << endl;
   int moon_kilo;
   moon_kilo = moon * 1.609;
   cout << "In kilometers, this is " << moon_kilo;
   cout << " km." << endl;

Paste the source code of your program below and click the Submit button when you are ready to submit this exercise.