Answered step by step
Verified Expert Solution
Question
1 Approved Answer
floatarray.cpp: // This program reads floating point data from a data file and places those // values into the private data member called values (a
floatarray.cpp:
// This program reads floating point data from a data file and places those // values into the private data member called values (a floating point array) // of the FloatList class. Those values are then printed to the screen. // The input is done by a member function called GetList. The output // is done by a member function called PrintList. The amount of data read in // is stored in the private data member called length. The member function // GetList is called first so that length can be initialized to zero. // PLACE YOUR NAME HERE #include#include #include using namespace std; const int MAX_LENGTH = 50; // MAX_LENGTH contains the maximum length of our list class FloatList // Declares a class that contains an array of // floating point numbers { public: void getList(ifstream&); // Member function that gets data from a file void printList() const; // Member function that prints data from that // file to the screen. FloatList(); // constructor that sets length to 0. ~FloatList(); // destructor private: int length; // Holds the number of elements in the array float values[MAX_LENGTH]; // The array of values }; int main() { ifstream tempData; // Defines a data file // Fill in the code to define an object called list of the class FloatList cout temperatures.txt:
78.9 87.4 60.8 70.4 75.6Please just follow the introduction on exercise(do not modfiy to the other form)
This is important so that I can learn some thing from your anwser. Thx
Retrieve program floatarray.cpp and temperatures.txt from the Lab 13 folder The code is as follows
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started