I need some help revising.

I need to make this code more user friendly for school. It needs to go to enter the initial gas quantity/odometer reading, then route to get a second count on a different chunk of text. I'm not too sure how to do it.
Thanks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <iostream>
#include <iomanip>

using std::cin;
using std::cout;
using std::endl;
using std::setw;
using namespace std;

int main()
{
   const int MAX(20);                      // Maximum number of values
   double gas[ MAX ];                      // Gas amount in gallons
   long miles[ MAX ];                      // Odometer readings
   int count(0);                           // Loop counter
   char indicator('y');                    // Input indicator

   while( ('y' == indicator || 'Y' == indicator) && count < MAX )
   {
      cout << endl << "Enter gas quantity: ";
      cin >> gas[count];                   // Read gas amount
      cout << "Enter odometer reading: ";
      cin >> miles[count];                 // Read odometer value

      ++count;
      cout << "Do you want to enter another(y or n)? ";
      cin >> indicator;
   }

   if(count <= 1)                     
   {                                  
      cout << endl << "Sorry - at least two readings are necessary.";
      cin.get();
      return 0;
   }

   // Output results from 2nd entry to last entry
   for(int i = 1; i < count; i++)
   {
     cout << endl
          << setw(2) << i << "."             // Output sequence number
          << "Gas purchased = " << gas[i] << " gallons" // Output gas
          << " resulted in "                 // Output miles per gallon
          << (miles[i] - miles[i - 1])/gas[i] << " miles per gallon.";
   }

   cout << endl;
   system("PAUSE");
   return 0;
}
Topic archived. No new replies allowed.