home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_05
/
1105083a
< prev
next >
Wrap
Text File
|
1993-03-01
|
855b
|
46 lines
// 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;
}