Computers and Technology, 24.09.2020 02:01 sammilower04
Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies.
Ex: If the input is:
0
or less, the output is:
no change
Ex: If the input is:
45
the output is:
1 quarter 2 dimes
Your program must define and call the following function. Positions 0-4 of coinVals should contain the number of dollars, quarters, dimes, nickels, and pennies, respectively.
void ExactChange(int userTotal, vector& coinVals)
#include
#include
using namespace std;
void ExactChange(int userTotal, vector& coinVals) {
if (penny == 1) {
cout << penny << "penny" << endl;
}
if (penny > 1) {
cout << penny << "pennies" << endl;
}
if (penny == 0) {
cout << "no change" << endl;
}
}
/* Define your function here */
int main() {
int inputVal;
vector changeAmount(5);
cin >> inputVal;
ExactChange(inputVal, changeAmount);
/* Type your code here. Your code must call the function. */
return 0;
}
Please help me with this problem using c++.
Answers: 3
Computers and Technology, 22.06.2019 15:30
Whats are the different parts of no verbal comunication, especially body language?
Answers: 3
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
Computers and Technology, 23.06.2019 07:30
What is the original authority for copyright laws
Answers: 1
Computers and Technology, 23.06.2019 15:30
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
Write a program with total change amount as an integer input that outputs the change using the fewes...
Mathematics, 15.12.2020 01:00
History, 15.12.2020 01:00
Biology, 15.12.2020 01:00
Mathematics, 15.12.2020 01:00
English, 15.12.2020 01:00
Mathematics, 15.12.2020 01:00
Advanced Placement (AP), 15.12.2020 01:00
Chemistry, 15.12.2020 01:00
Mathematics, 15.12.2020 01:00
Physics, 15.12.2020 01:00
English, 15.12.2020 01:00
Mathematics, 15.12.2020 01:00