
Chapter 13: Prelab Assignment
Array-Based Lists | 335
Name __________________________________________ Date _______________________
Section _________________________________________
Read program FloatLst carefully.
#include <iostream>
#include <fstream>
using namespace std;
const int MAX_LENGTH = 50;
class FloatList
{
public:
void GetList(ifstream&);
void PrintList();
FloatList();
private:
int length;
float values[MAX_LENGTH];
};
int main ()
{
ifstream tempData;
FloatList list;
cout << fixed << showpoint;
tempData.open("real.dat");
list.GetList(tempData);
list.PrintList();
return 0;
}
//*******************************************
FloatList::FloatList()
{
length = 0;
}
//******************************************* ...