编辑代码

#include <iostream>
using namespace std;
void sendmoney(string m,int x,int a[],int j)
{
    int b[j]={0};
    int n=0;
    int l=x;
    for(int i=0;i<j;i++)
    {
        n=x/a[i];
        b[i]=n;
        x=x-n*a[i];
    }
    cout<<m<<"发放工资:"<<l<<"元"<<" "<<"共计需要钱币个数:";
    for(int t=0;t<j;t++)
    {
        cout<<b[t]<<"张"<<a[t]<<"元"<<" ";
    }
    cout<<endl;
}
int main() {
    int a[5]={100,50,10,5,1};
    string c[5]={"wanghong","liyan","zhaolin","zhangjun","huahua"};
    int b[5]={2135,1862,2639,2581,1234};
    for(int i=0;i<5;i++)
    {
        sendmoney(c[i],b[i],a,5);
    }
    return 0;
}