1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeka57 [31]
3 years ago
10

6.32 LAB: Exact change - functions

Engineering
1 answer:
Neko [114]3 years ago
5 0

Answer:

Below is the desired C++ program for the problem. Do feel free to edit it according to your preference

Explanation:

#include <iostream>

#include <vector>

using namespace std;

void ExactChange(int userTotal, vector<int> &coinVals) {

   coinVals.reserve(5);

   coinVals[0] = userTotal / 100;

   userTotal %= 100;

   coinVals[1] = userTotal / 25;

   userTotal %= 25;

   coinVals[2] = userTotal / 10;

   userTotal %= 10;

   coinVals[3] = userTotal / 5;

   userTotal %= 5;

   coinVals[4] = userTotal;

}

int main() {

   vector<int> coins;

   int value;

   cin >> value;

   if (value <= 0) {

       cout << "no change" << endl;

   } else {

       ExactChange(value, coins);

       if (coins[0] != 0) cout << coins[0] << " " << (coins[0] == 1 ? "dollar" : "dollars") << endl;

       if (coins[1] != 0) cout << coins[1] << " " << (coins[1] == 1 ? "quarter" : "quarters") << endl;

       if (coins[2] != 0) cout << coins[2] << " " << (coins[2] == 1 ? "dime" : "dimes") << endl;

       if (coins[3] != 0) cout << coins[3] << " " << (coins[3] == 1 ? "nickel" : "nickels") << endl;

       if (coins[4] != 0) cout << coins[4] << " " << (coins[4] == 1 ? "penny" : "pennies") << endl;

   }

   return 0;

}

You might be interested in
A(n) _____ is an apparatus that changes alternating current (AC) to direct current (DC)
amid [387]

Answer:

rectifier

Explanation:

7 0
2 years ago
For somebody
Brums [2.3K]

Answer:

Cool song

Explanation:

Ur hot also

4 0
3 years ago
What are some common work contexts for Licensing Examiners and Inspectors? Select four options.
Akimi4 [234]

According to O*NET, the common work contexts for Licensing Examiners and Inspectors include:

  1. Telephone
  2. Face-to-face discussions
  3. Contact with others
  4. Importance of being exact or accurate.

O*NET is an acronym for occupational information network and it refers to a free resource center or online database that is updated from time to time with several occupational definitions, so as to help the following categories of people understand the current work situation in the United States of America:

  • Workforce development professionals
  • Students
  • Human resource (HR) managers
  • Job seekers
  • Business firms

On O*NET, work contexts are typically used to describe the physical and social elements that are common to a particular profession or occupational work. Also, the less common work contexts are listed toward the bottom while common work contexts are listed toward the top.

According to O*NET, the common work contexts for Licensing Examiners and Inspectors include:

1. Telephone

2. Face-to-face discussions

3. Contact with others

4. Importance of being exact or accurate.

Read more on work contexts here: brainly.com/question/22826220

6 0
2 years ago
Read 2 more answers
Which of the following positions would be responsible for attaching I-beams to a crane?
prohojiy [21]

Answer:

Rigger

Explanation:

<em> work as one</em>

4 0
2 years ago
A home electrical system is joined to the electric company's system at the junction of the
aleksandrvk [35]

That would be B, I hope this helps!

5 0
2 years ago
Other questions:
  • given the classes above, what output is produced by the following code? meg[] elements ={new Lois(), new Stewie(), new Meg(), ne
    15·1 answer
  • A multilane highway (two lanes in each direction) is on level terrain. The free-flow speed has been measured at 45 mi/h. The pea
    5·1 answer
  • A 40 mph wind is blowing past your house and speeds up as it flows up and over the roof. If the elevation effects are negligible
    14·1 answer
  • Convection ovens operate on the principle of inducing forced convection inside the oven chamber with a fan. A small cake is to b
    6·1 answer
  • A railroad runs form city A to city B, a distance of 800km, through mountainous terrain. The present one-way travel time (includ
    13·1 answer
  • I have a question for you guys
    13·2 answers
  • An aluminum bar 125 mm long with a square cross section 16 mm on an edge is pulled in tension with a load of 66,700 N and experi
    14·1 answer
  • A jet aircraft is in level flight at an altitude of 30,000 ft with an airspeed of 500 ft/s. The aircraft has a gross weight of 1
    11·1 answer
  • I want to solve the question
    11·1 answer
  • In python, how would I randomize numbers and insert them into a file?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!