#include<iostream>
using namespace std;
const int SIZE = 5;
int coin[SIZE] = { 100, 50, 10, 5, 1};
string name[SIZE] = {"100元", "50元", "10元", "5元", "1元"};
int num[SIZE];
int exchange(int n)
{
int i;
for (i=0; i<SIZE; i++)
if (n >= coin[i]) break;
while (n>0 && i<SIZE)
{
if(n >= coin[i])
{
n -= coin[i];
num[i]++;
}else if(n<10 && n>=5)
{
num[SIZE-1]++;
break;
}else i++;
}
for(int i=0; i<SIZE; i++)
{
cout << name[i] << "币种: " << num[i] << " 张\n";
}
return 0;
}
int main()
{
double money;
cout << "王红工资2135:"<<endl;
exchange(2135);
cout << "加上李言工资1862:"<<endl;
exchange(1862);
cout << "加上赵林工资2639:"<<endl;
exchange(2639);
cout << "加上张军工资2581得最后的总张数是:"<<endl;
exchange(2581);
return 0;
}