编辑代码

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

int main() {
    int n, gz;
    int b[7] = { 0, 100,50, 20, 10, 5, 1 };
    int s[7] = { 0, 0, 0, 0, 0, 0, 0 };
    cout << "请输入员工人数:";
    cin >> n;
    for (int i = 1; i <= n; i++) {
        memset(s, 0, sizeof s);//清空s数组
        cout << "请输入每位员工的工资:";
        cin >> gz;
        for (int j = 1; j <= 6; j++) {
            int a = gz / b[j];
            s[j] += a;
            gz -= a * b[j];
        }

        for (int i = 1; i <= 6; i++) {
            cout << b[i] << "---" << s[i] << endl;
        }
        cout << endl;
    }

    return 0;
}