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
Careful planning will save time, __________, and energy while ensuring the production of a high quality product.
Svet_ta [14]
Juicers nb 345676 at that rate it will be amazing
5 0
3 years ago
If welding is being done in the vertical position, the torch should have a travel angle of?
siniylev [52]

Answer:

Between 35°– 45°

Explanation:

In the vertical position, Point the flame in the direction of travel. Keep the flame tip at the correct height above the base metal. An angle of 35°–45° should be maintained between the torch tip and the base metal. This angle may be varied up or down to heat or cool the weld pool if it is too narrow or too wide

4 0
2 years ago
Select the correct answer. Ruby wants to create a cube puzzle game. For that she has to create a cube. Which drafting tool do yo
Alexxx [7]

Answer:

D. a triangle and a T-Square

Explanation:

A T-Square is the best drawing tool to create squares. You would need a squares to create cubes.

3 0
3 years ago
Please help!!
Inessa05 [86]

Answer:

I think that the answer is the Chinese

Explanation:

3 0
3 years ago
Read 2 more answers
Determine the deflection at the center of the beam. Express your answer in terms of some or all of the variables LLL, EEE, III,
Rom4ik [11]

Answer:

See explanations for step by step procedures to get answer.

Explanation:

Given that;

Determine the deflection at the center of the beam. Express your answer in terms of some or all of the variables LLL, EEE, III, and M0M0M_0. Enter positive value if the deflection is upward and negative value if the deflection is downward.

4 0
4 years ago
Other questions:
  • Technician A says that you don’t need to use an exhaust extraction system when working on vehicles equipped with a catalytic con
    9·1 answer
  • What is the energy change when the temperature of 15.0 grams of solid silver is decreased from 37.3 °C to 20.5 °C ?
    13·1 answer
  • In the combination of resistors above, consider the 1.50 µΩ and 0.75 µΩ. How can you classify the connection between these two r
    6·1 answer
  • 4 main causes of erosion
    12·1 answer
  • In a wire, when elongation is 4 cm energy stored is E. if it is stretched by 4 cm, then what amount of elastic potential energy
    15·2 answers
  • The three suspender bars AB, CD, and EF are made of A-36 steel and have equal cross-sectional areas of 500 mm2. Determine the av
    9·1 answer
  • Cup-sveg-aph<br><br>I m finding gf<br><br>if anyone interested pls come​
    11·2 answers
  • Agricultural economics is a study of how agriculture and business are related.<br> False<br> True
    15·1 answer
  • Many vehicles have indicator lights telling you when your
    13·1 answer
  • Write down about the water source selection criteria​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!