Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

We have to write the following program and I have no idea what\'s going on. The

ID: 3650935 • Letter: W

Question

We have to write the following program and I have no idea what's going on.
The program asks for an integer dollar amount and make
change. For example,
How many dollars? 27
Your change is:
1 20-dollar bill
1 5-dollar bill
1 2-dollar bill
Continue to use an initializer list for the vector of dollar bill denominations,
and use a range-based for statement to traverse the vector.

Explanation / Answer

#include #include using namespace std; int main() { int dollar,i; int vec[7]={0,0,0,0,0,0,0}; //100,50,20,10,5,2,1 dollars are considered coutdollar; for(i=dollar;i>0;) { if(i>=100) { vec[0]=i/100; i=i%100; } else if(i>=50){ vec[1]= i/50; i=i%50; } else if (i>=20) {vec[2]= i/20; i=i%20; } else if(i>=10){ vec[3]= i/10; i=i%10; } else if (i>=5){ vec[4]= i/5; i=i%5; } else if (i>=2){ vec[5]= i/2; i=i%2; } else vec[6]=i; } cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote