What changes would need be made to Listing 7.15 so that the functions fill() and show() use
Question:
What changes would need be made to Listing 7.15 so that the functions fill() and show() use reference parameters?
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
Transcribed Image Text:
Listing 7.15 arrobj.cpp
//arrobj.cpp - functions with array objects (C++11)
#include
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 << "\nEXPENSES\n";
for (int i = 0; i < Seasons; i++)
{
cout << Snames [1] << ": $" << da[i] << endl;
total da [i];
}
cout << "Total Expenses: $" << total << endl;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 64% (14 reviews)
ANSWER The changes that would need to be made to Listing ...View the full answer
Answered By
Dennis Nyangau
I have been tutoring for several years now, and I absolutely love it! I love being able to help students one-on-one and see them succeed. It is so gratifying to see a student understand a concept that they were struggling with before. I also enjoy getting to know my students and helping them to reach their full potential.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
What changes would be needed for Windows 2000 to run a process that uses a 64-bit address space?
-
Show how quick sort can be made to run in O (n lg n) time in the worst case.
-
A helical compression spring is to be made of oil-tempered wire of 4-mm diameter with a spring index of C = 10. The spring is to operate inside a hole, so buckling is not a problem and the ends can...
-
Hardie Lord, Helen Murvis's boss, is not convinced that Helen used the correct decision technique. Hardie believes that Helen should use a coefficient of realism of 0.75 in determining the best...
-
Compare and contrast the roles that a firm's treasurer and controller have in the operation of the firm.
-
Howard Murphy is the owner of Stormy Banana Films in West Hollywood, California. Stormy Banana Films had 15 employees with total annual wages of $214,750 (no one exceeded the Medicare tax surcharge...
-
Perform a strengths, weaknesses, opportunities and threats (SWOT) analysis on ASOS.
-
Balthus Corp. reports the following components of stockholders equity on December 31, 2013: Common stock $ 1 par value, 320,000 shares authorized, 200,000 shares issued and outstanding . . . . . . ....
-
11. If an object in free fall takes 3.8 seconds to hit the ground, how far did it fall? 12. While sitting in class, your calculator falls off your desk that is 1.2 meters tall. What is the velocity...
-
Kelly Pitney began her consulting business, Kelly Consulting, on April 1, 2016. The accounting cycle for Kelly Consulting for April, including financial statements, was illustrated in this chapter....
-
The following is a program skeleton: #include using namespace std; #include // for strlen(), strcpy() struct stringy { char * str; // points to a string int ct; // length of string (not counting...
-
The following is a structure template: struct box { char maker[40]; float height; float width; float length; float volume; }; a. Write a function that has a reference to a box structure as its formal...
-
Why should you include a rationale statement?
-
Havel and Petra are married and will file a joint tax return. Havel has W - 2 income of $ 4 0 , 2 4 0 , and Petra has W - 2 income of $ 4 6 , 6 7 7 . Use the appropriate Tax Tables and Tax Rate...
-
Integrated Marketing Communications focuses on digital marketing channels such as social media and search engines but usually does not include traditional media channels. Is it true explain.
-
A salesperson can develop numerous types of value analyses for a prospective buyer. List three types of frequently used value analyses.
-
Brie signs an instrument in which she promises to pay Carmen a certain price for her Dodge Dart. The instrument will be negotiable if it meets all of the requirements for negotiability, including...
-
(Bond in the term structure, 20 points) Consider a 5-year, 7% coupon bond, paid annually, with a face value of $100 in a market with the following short rates. To n 5.00 5.50 5.90 6.25 6.50 (a) Find...
-
The internal energy of a system increases by 400 J while 500 J of work are performed on it. What was the heat flow into or out of the system?
-
If a process has a six-sigma capability, what is the process capability index? a. 1 b. 2 c. 6 d. 12
-
Write a code segment to ask a user to enter a number between 1 and 12 , and print the name of the month corresponding to the number. Use a selection structure.
-
Repeat the previous exercise using a selection structure instead of a case structure. Data From previous exercise Write a code segment to ask a user to enter a number between 1 and 4 , and print the...
-
Write a code segment to ask a user to enter a number between 1 and 4 , and print the name of the class (First-Year, Sophomore, Junior, and Senior) corresponding to the number. Use a case structure.
-
Diverse Perspectives on the World Economy assignment You are required to consider a contemporary economic or social issue that is currently attracting media attention. It could be a local, national,...
-
Daniel made the following transactions during the first week of January. 1 January Buys stock for 350 on credit 3 January Makes sales of 740 on credit 4 January Cash paid to a supplier of 120, for...
-
Please answer all parts of the following question. Given the following information: Total Product (TP) Price Fixed Cost (TFC) Variable Cost (TVC) 0 $1000 $600 $ 0 1 1000 600 1200 2 1000 600 2000 3...
Study smarter with the SolutionInn App