
Who can solve this C++?
Design a program that receives data as a whole, corresponding to an amount of money and
calculates and prints the best breakdown (the minimum number of currency units). Units
currency are: (10000,5000,2000,1000,500,200,100,50,25,… The program stores these
quantities ordered and broken down into a vector quantity in increasing order of
components of the vector. After printing the breakdown, the program will break down further
quantities, printed at the end the total number of banknotes and coins of each class.
You do not need to take into account cents. Coins / notes to consider are:
500,200,10,50,20,10,5,2,1 Euros.
int currency[9] = {10000,5000,2000,1000,500,200,100,50,25}…
int counts[9];
for (int i = 0; i < 9; i++)
{
counts[i] = amount / currency[i];
amount -= counts[i] * currency[i];
}
The above loop will go through each currency and figure out how many of each is in the amount. It then saves that in counts.
The total amount is then reduced so for the next currency it is only dealing with what is left.
You can go through the counts array to display the amount per currency.
Your currency list was short so you will probably have more than 9.
Lego NXT Banknote (Money) Changer – ATM
|
|
CHILE 50 Pesos – 5 Cents O/P Banknote World Money Currency South American BILL $0.00 |
|
|
1875 US Cover w/ Block of 3 cent Banknotes $0.00 |
|
|
1880 US Cover with 9 Three Cent Banknote Issues Purple $0.00 |
|
|
10 CENTS Banknote CHINA 1949 – KWEICHOW Province Issue – Pick S2463 – Crisp AU+ $0.00 |
|
|
ZIMBABWE 1 CENT Banknote World Money UNC Currency BILL $0.00 |
|
|
USA 1870 – scott 153 – VF- Superb – used – Purple 24 cent Banknote $0.00 |
|
|
MOURNING COVER — 1 CENT SMALL BANKNOTE $0.00 |
|
|
SC #136 — GRILLED 3 CENT BANKNOTE $0.00 |
|
|
1877 3 Cent Washington Banknote on COVER + Letter FANCY CANCEL $0.00 |
|
|
1879 3 Cent Washington Banknote on COVER w/ Octagonal Dunkirk O CANCEL $0.00 |
|
|
Scarce Sarawak 1st August 1940 Ten Cents Banknote Very Fine $0.00 |
|
|
SC #189S — 15 CENT BANKNOTE – BLUE TRIAL COLOR – OVERPRINTED SAMPLE IN RED $0.00 |
|
|
Shields & Brother “Enterprise Manufacturing Co” GREAT reverse! 2 cent banknote $0.00 |
|
|
3 CENT BANKNOTE – NEW YORK FANCY CANCEL – 1873 $0.00 |
|
|
ZIMBABWE BANKNOTE 1 CENT BEARER CHEQUE 2006 P33 UNC $0.00 |
|
|
ZIMBABWE BANKNOTE 5 CENTS BEARER CHEQUE 2006 P34 UNC $0.00 |
|
|
ZIMBABWE BANKNOTE 10 CENTS BEARER CHEQUE 2006 P35 UNC $0.00 |
|
|
ZIMBABWE BANKNOTE 50 CENTS BEARER CHEQUE 2006 P36 UNC $0.00 |
|
|
4 x ZIMBABWE The CENTS Banknotes Africa World Money UNC BILL Currency Notes 2006 $0.00 |
|
|
2 x ZIMBABWE 1 cent/$100 Trillion Banknotes Africa World Money BILL Currency UNC $0.00 |
|
|
ZIMBABWE 5 CENT Banknote World Paper Money UNC Currency Africa Note p34 Cheque $0.00 |
|
|
32 BANKNOTE ZIMBABWE SET 1 CENT TO 100 BILLION +HOLDERS $0.00 |
|
|
FRENCH INDO-CHINA – 10 CENTS 1939 XF/AU – P 85 – ..204. Lot of 2 banknotes. RARE $0.00 |
|
|
FRENCH INDO-CHINA – 10 CENTS 1939 XF/AU – P 85 – ..739. Lot of 2 banknotes. RARE $0.00 |
|
|
FRENCH INDO-CHINA – 10 CENTS 1939 XF/AU – P 85 – ..202. Lot of 2 Banknotes. RARE $0.00 |
|
|
HONG KONG BANKNOTE 1 CENT P325 UNC $0.00 |
|
|
CONGO 5 Cents Banknote World Money Currency BILL p81 Note 1997 Suku Mask Africa $0.00 |
|
|
CAMBODIA 100 CENT RIELS 1956 UNCIRCULATED BANKNOTE 5 PIECES WOW LOOK! LOOK HERE! $0.00 |
|
|
China uncirculated 100 pcs 1953 1 cent banknote $0.00 |
|
|
China uncirculated 100 pcs 1953 5 cent banknote $0.00 |
|
|
CONGO 10 Cents Banknote World Money UNC Currency BILL p82 Note 1997 Dancers Mask $0.00 |
|
|
Litiz, Pennsylvania ( light) cancel on US 3 cent banknote E1 $0.00 |
|
|
95pc china hongkong queen head 1cent unc banknote $0.00 |
|
|
US half dollar banknote 50 cent tyvek vegan mens slim Mighty Wallet bifold gift $0.00 |
|
|
Malaya PK# 9a 1941 20 Cents Banknote $0.00 |
|
|
BANKNOTE — 6 CENTS TO CANADA — 1871 $0.00 |
|
|
CONGO 50 Cents Banknote World Money UNC Currency BILL p84 Note 1997 Herd Okapis $0.00 |
|
|
20 CENTS Banknote of CHINA – 1940 – SUN YAT-SEN Portrait – Pick 227 – Crisp UNC $0.00 |
|
|
TAIWAN 50 Cents Banknote World Currency Money BILL Asia Note p1949b 1949 Dr. SYS $0.00 |
|
|
1936 China one cent paper money banknote, red, off center cut, c descriptions $0.00 |
|
|
Straits Settlements 10 Cents banknote 1919, A UNC. Pick 8b. $0.00 |
|
|
5 CENT TAYLOR BANKNOTE TO MEXICO – 1882 $0.00 |
|
|
#152, 15 cent Webster Banknote $0.00 |
|
|
SCOTT 146 1870 2 CENT JACKSON BANKNOTE REGULAR ISSUE USED F-VF CAT $12! $0.00 |
|
|
1941 GEORGE VI MALAYA 10 CENTS BANKNOTE $0.00 |
|
|
Government of Hongkong Hong Kong One Cent Currency Paper Money Banknote $0.00 |
|
|
1941 Malaya Malaysia 10 Ten Cents Uniface Currency Paper Money Banknote $0.00 |
|
|
CHILE 100 Pesos O/P 10 cents Banknote World Money Currency BILL South America $0.00 |
|
|
World Banknotes China (Taiwan) 1949 50 cents P 1949 GEM UNC Prefix K suffix Y $0.00 |
|
|
SCOTT 211 1883 4 CENT JACKSON BANKNOTE REGULAR ISSUE USED F-VF CAT $18! $0.00 |
Related Articles
No user responded in this post
Leave A Reply