Question: Redo Listing 7.15 without using the array class. Do two versions: a. Use an ordinary array of const char * for the strings representing the
Redo Listing 7.15 without using the array class. Do two versions:
a. Use an ordinary array of const char * for the strings representing the season names, and use an ordinary array of double for the expenses.
b. Use an ordinary array of const char * for the strings representing the season names, and use a structure whose sole member is an ordinary array of double for the expenses. (This design is similar to the basic design of the array class.)

Here’s a sample run:
Enter Spring expenses: 212
Enter Summer expenses: 256
Enter Fall expenses: 208
Enter Winter expenses: 244
EXPENSES
Spring: $212
Summer: $256
Fall: $208
Winter: $244
Total: $920
} Listing 7.15 arrobj.cpp //arrobj.cpp #include #include #include // constant data const int seasons = 4; const std:: array Snames = {"Spring", "Summer", "Fall", "Winter"}; functions with array objects (C++11) // function to modify array object void fill (std:: array * pa); // function that uses array object without modifying it void show (std:: array da); int main() { } } std:: array expenses; fill (&expenses); show (expenses); return 0; void fill (std:: array pa). { using namespace std; for (int i = 0; i < Seasons; i++) { cout < < "Enter" < < Snames [1] < < " expenses: cin >> (*pa) [i]; void show (std:: array da) { using namespace std; double total = 0.0; cout < < " EXPENSES "; for (int i = 0; i < Seasons; i++) { cout < < Snames[i]
Step by Step Solution
3.45 Rating (171 Votes )
There are 3 Steps involved in it
ANSWER Listing 715 without using the array class Do two versions a Use ... View full answer
Get step-by-step solutions from verified subject matter experts
