#include
int main()
{
using namespace std;
cout<<"Enter the student IDs(-1 to stop)";
int a[20]={};
int b[20]={};
int i=0;
int x,y;
while (a[i]!=-1)
{
cin>>a[i];
i++;
}
a[20] = {0}说明a[i] == 0
那a[i]!=-1永远成立 不久死循环了
while (a[i]!=-1)
while (a[i]!=-1) 此时a[i]并未被输入