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: 66% (15 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.
-
A local manufacturing plant has three work stations (as shown in the following figure) with two machines operating in parallel in workstation 1. In other words, before proceeding to station 2, the...
-
Describe how we determine the statistical significance of the odds ratio, using a confidence interval.
-
On April 1, Year 1, Company P purchased 85% of S Company for total consideration of $357,000, which included $30,000 of contingent consideration as measured according to GAAP at fair value. Each...
-
Required information The following information applies to the questions displayed below.) Fausett Electronics, Inc, headquartered in Richfield, Minnesota, is one of the leading consumer electronics...
-
The next diagram depicts a system of aqueducts that originate at three rivers (nodes R1, R2, and R3) and terminate at a major city (node T), where the other nodes are junction points in the system....
-
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...
-
A piece of transparent plastic is molded into the shape of a converging lens, but it is hollow inside and has only a thin plastic wall. If immersed in water, would this air-filled lens act as a...
-
Your client who is currently using only Facebook and Instagram wants to try LinkedIn. What would you do first ? and why ?
-
Exro Technologies Corp. (Exro) is an upstart Canadian company that specializes in the manufacture of electric motors and batteries for electric bikes. Exro uses a job costing system and during...
-
How do neurobiological mechanisms, such as the stress response system and emotional regulation pathways, influence the dynamics of conflict escalation and resolution?
-
What is the consideration to invest in the company which has recorded revenue growth over the past 5 years but the Debt to Equity ratio also increase significantly to 5.72?
-
Builder Products, Incorporated, uses the weighted-average method in its process costing system. It manufactures a caulking compound that goes through three processing stages prior to completion....
-
For each function that is one-to-one, (a) write an equation for the inverse function, (b) graph and -1 on the same axes, and (c) give the domain and range of both f and -1 . If the function is not...
-
Construct a 4 x 25 design confounded in two blocks of 16 observations each. Outline the analysis of variance for this design.
-
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.
-
What general conclusions can you draw about your companys liquidity, solvency and productivity based on your ratio calculations. Working Capital 2017 = $9,994 M 2016 = $10,673 M Current Ratio 2017 =...
-
Tami Tyler opened Tami's Creations, Incorporated, a small manufacturing company, at the beginning of the year. Getting the company through its first quarter of operations placed a considerable strain...
-
5. The current spot exchange rate is 0.95/$ and the three-month forward rate is 0.91/$. Based on your analysis of the exchange rate, you are pretty confident that the spot exchange rate will be...
Study smarter with the SolutionInn App