#include <iostream>
using namespace std;
int main()
{
int naifen[5];
int buhege = 0;
printf("依次输入5罐奶粉的重量\n");
for (int i = 0; i < 5; i++)
{
cout << "第 " << i << " 罐重量:";
cin >> naifen[i];
}
cout << endl;
//检测
for (int i = 0; i < 5; i++)
{
if ((naifen[i] < 500) || (naifen[i]>550))
{
cout << "第 " << i << " 罐不合格," << naifen[i] << "克" << endl;
buhege++;
}
}
cout << "不合格比例:" << buhege * 100 / 5 << "%";
return 0;
}