#include <iostream.h> 
#include<fstream.h>
const double pi = 3.14159;
// Define the cylinder class:
class cylinder {
  public: double radius, length;
          double volume ( ) {return pi * radius * radius * length;}
};
// Define cylinder array:
cylinder oil_tanks[100];
main ( ) {
  // Declare various variables:
  int limit, counter;
  double sum = 0.0;
  // Connect an input stream to the file named test.data:     ///
  ifstream cylinder_stream ("test.data", ios::in);            ///
  // Connect an output stream to the file named test.result:  ///
  ofstream volume_stream ("test.result", ios::out);           ///
  // Read numbers from the test.data file:
  for (limit = 0;
       cylinder_stream >> oil_tanks[limit].radius
                       >> oil_tanks[limit].length;
       ++limit)
    ;
  // Compute volume:
  for (counter = 0; counter < limit; ++counter)
    sum = sum + oil_tanks[counter].volume ( );
  // Write sum into the test.result file:
  volume_stream << "The total volume in the "
                << limit << " storage tanks is "
                << sum << endl;
}
