Listing 6 Test program for float_vector

// tv1.cpp - a test program for float_vectors and
// float_arrays

#include <iostream.h>
#include "fv1.h"

void display(const char *s, const float_array &fa)
       {
       cout << s << " = " << fa << endl;
       }
int main()
       {
       int i, low, high;
       cout << "low? ";
       cin >> low;
       cout << "high? ";
       cin >> high;

       float_vector fa(low, high);
       for (i = fa.low(); i <= fa.high(); ++i)
              fa[i] = i;
       display("fa", fa);
       float_vector fb = fa;
       display("fb", fb);
       for (i = low; i < low + 2 * fa.length(); ++i)
              {
              fb[i] = i * i;
              display("fb", fb);
              }
       cout << "fb.low() = " << fb.low() << '\n';
       cout << "fb.high() = " << fb.high() << '\n';
       float_array fc = fa;
       display("fc", fc);
       i = fc.length();
       fc[i - 1] = 123;
       display("fc", fc);
       cout << "fa[" << low - 1 << "] = ";
       cout << fa[low - 1] << '\n';
       return 0;
       }

// End of File