0

part 1
find the most efficient way of making change for any amount of money up to $200.00. the most efficient way means the fewer pieces of currency. the following are the values of monies to use.
$ 100.00 $1.00
$ 50.00 $.50
$20.00 $.25
$10.00 $.10
$5.00 $.05
$2.00 $.01
for example, if i were to give you change of $8.93, the most efficient would be 1-$5.00, 1-$2.00, 1-$1.00, 1-$.50, 1-$.25, 1-$.10, 1- $.05, 3- $.01. only tell me the change i will get, not what i will not get.

part 2
if the amount of the change is $10.00 or less, i want you to tell me the number of different ways you could have made change for that amount. for example, if the my change was $.25, you give me a quarter, but tell me that there are 13 different ways you could have made change ( or if any change was $0.50, you would give me a hal-dollar and tell me there are 50 ways you could have made change). run the program to show the result for $10.00 = $5.00 - $4.00 - $3.00 - $2.00 - $1.00 - $.50 - $0.25 - $0.10.

#include "stdafx.h"
#include <iostream>
using std:cout;
using std:cin;

int hundredD;
int fiftyD;
int twentyD;
int tenD;
int fiveD;
int twoD;
int oneD;
int fiftyC;
int quarter;
int dime;
int nickle;
int penny;

double change; // Whatever this is.

hundredD = change / 100;
change = change % hundred;
fiftyD = change / 50;
change = change % 50;
twentyD = change / 20;
change = change % 20;
tenD = change / 10;
change = change % 10;
fiveD = change / 5;
change = change % 5;
twoD = change/ 2;
change = change % 2; 
oneD = change / 1;
change = change %1;
fiftyC = change / 0.50;
change = change % 0.50; 
quarter = change / 0.25;
change = change %0.25; 
dime = change / 0.10;
change = change % 0.10;
nickle = change /  0.05;
change = change % 0.05;
penny = change / 0.01;
change = change % 0.01

I am confuse, what do you do next. Can someone please please explain this to me?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by Ancient Dragon
0

1) First off I assume you are an American because that's American currency you have to deal with. If not, then you might have a problem.

2) Second, I assume you know how to make change. If you owe me 25 cents and give me a 10.00 bill, how much change should I give you ? And what coins/bills should I give you ? This is a very practical problem that occurs every time you go to a store and buy something. If you can't answer that question then start preying -- err I mean start studying.

Lines 19-44 of the code you posted must be inside main() function

int main()
{
   // blabla lines 19-44
}

>>double change; // Whatever this is.

That should be initialized to the amount of change you have to give out, such as 9.75 in the example I posted above. But instead of just hard-coding some value there you will need to ask for it

cout << "Enter amount of change\n";
cin >> change;

Edited by Ancient Dragon: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.