C++ Programming

Design and create a class named Stats that has an array of 12 doubles as one of its member variables. The values in the array should be set by making 12 calls to a public member function named setValue that accepts two arguments, an integer indicating which value is being provided (the first number, the second number….etc) and a double holding the actual data value. what does that mean? I made this #include #include using namespace std; class Stats { private: double values[12]; public Stats(); }; void Stats::Stats() { int num; for(int i = 0; i

Answers

No, that is not what it means. The class is supposed to have a public member function named setValue that accepts two arguments, with one of them being an integer indicating which value is being provided, and the second argument being a double holding the actual data value. With this function, the user would be able to provide each of the 12 values for the array individually, rather than having to initialize the array with the values at once.

Answered by garzaerica

We have mentors from

Contact support