#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
main(){
int note
[5],coin
[3],x
,count[8],show
[8],bath
=0; string kind;
coin[0] = 1;
coin[1] = 5;
coin[2] = 10;
note[0] = 20;
note[1] = 50;
note[2] = 100;
note[3] = 500;
note[4] = 1000;
for(;;){
cout<<"Please enter\"coins\"or\"notes\"."<<endl;
cin>>kind;
if(kind=="coins"){
cout<<"Enter type of types and amount of coins.(1 5 10)\nex. 5 2\n"<<endl;
cin>>kind>>x;
if(kind
=="1") {bath
+=(count[0] +=(coin
[0]*x
));} if(kind
=="5") {bath
+=(count[0] +=(coin
[1]*x
));} if(kind
=="10") {bath
+=(count[0] +=(coin
[2]*x
));} cout<<endl;
cout
<<"\t"<<(show
[0])=count[0]/coin
[0])<<"\t1\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[1])=count[1]/coin
[1])<<"\t5\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[2])=count[2]/coin
[2])<<"\t10\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[3])=count[0]/note
[0])<<"\t20\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[4])=count[1]/note
[1])<<"\t50\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[5])=count[2]/note
[2])<<"\t100\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[6])=count[3]/note
[3])<<"\t500\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[7])=count[4]/note
[4])<<"\t1000\tcoin(s)"<<endl
; cout<<endl<<"The total money valuebalue is\t"<<bath<<"\tbath.\n\n"<<endl;
}else{
if(kind == "notes"){
cout<<"Enter types of types and amount of notes.( 20 50 100 500 1000)\nex.100 5\n" <<endl;
cin>>kind>> x;
if (kind
== "20") {bath
+=(count[3]) +=(note
[0]*x
));} if (kind
== "50") {bath
+=(count[4]) +=(note
[1]*x
));} if (kind
== "100") {bath
+=(count[5]) +=(note
[2]*x
));} if (kind
== "500") {bath
+=(count[6]) +=(note
[3]*x
));} if (kind
== "1000") {bath
+=(count[7]) +=(note
[4]*x
));} cout<<endl;
cout
<<"\t"<<(show
[0])=count[0]/coin
[0])<<"\t1\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[1])=count[1]/coin
[1])<<"\t5\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[2])=count[2]/coin
[2])<<"\t10\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[3])=count[0]/note
[0])<<"\t20\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[4])=count[1]/note
[1])<<"\t50\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[5])=count[2]/note
[2])<<"\t100\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[6])=count[3]/note
[3])<<"\t500\tcoin(s)"<<endl
; cout
<<"\t"<<(show
[7])=count[4]/note
[4])<<"\t1000\tcoin(s)"<<endl
; cout<<endl<<"The total money valuebalue is\t"<<bath<<"\tbath.\n\n"<<endl;
}else{ if (( kind != "coins")&&(kinds != "notes")) {
system("cls"); cout
<< "incorrect type!";}} }
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8c3RkbGliLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cm1haW4oKXsKCWludCBub3RlWzVdLGNvaW5bM10seCxjb3VudFs4XSxzaG93WzhdLGJhdGg9MDsKCXN0cmluZyBraW5kOwoJY29pblswXSA9IDE7Cgljb2luWzFdID0gNTsKCWNvaW5bMl0gPSAxMDsKCW5vdGVbMF0gPSAyMDsKCW5vdGVbMV0gPSA1MDsKCW5vdGVbMl0gPSAxMDA7Cglub3RlWzNdID0gNTAwOwoJbm90ZVs0XSA9IDEwMDA7Cgljb3VudFswXSA9IDA7IGNvdW50WzFdID0gMDsgY291bnRbMl0gPSAwOyBjb3VudFszXSA9IDA7Cgljb3VudFs0XSA9IDA7IGNvdW50WzVdID0gMDsgY291bnRbNl0gPSAwOyBjb3VudFs3XSA9IDA7Cglmb3IoOzspewoJCWN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