Question: What changes would need be made to Listing 7.15 so that the functions fill() and show() use reference parameters? Heres a sample run: Enter Spring

What changes would need be made to Listing 7.15 so that the functions fill() and show() use reference parameters?

Listing 7.15 arrobj.cpp //arrobj.cpp - functions with array objects (C++11) #include #include

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 - functions with array objects (C++11) #include #include #include // constant data. const int seasons = 4; const std::array Snames = {"Spring", "Summer", "Fall", "Winter"); // 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() { } void fill (std:: array pa). { } std:: array expenses; fill(&expenses); show (expenses); return 0; } using namespace std; for (int i = 0; i < Seasons; i++) { } void show (std:: array da) { cout < < "Enter" < < Snames [1] < < " expenses: "; cin>> (*pa) [1]; 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 [1] < < ": $" < < da[i] < < endl; total da [i]; } cout < < "Total Expenses: $" < < total < < endl;

Step by Step Solution

3.49 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER The changes that would need to be made to Listing ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction Java Program Questions!