为什么当while不满足语句条件的时候依然循环
#include<iostream>
#include<stack>
using std::cin;
using std::cout;
using std::endl;
using std::stack;
int main()
{
int people[200000];
int N,a,b;
while (cin >> N != 0)
{
stack<int> couple;
for (int i = 0;i < N;i++)
{
cin >> a >> b;
people[a - 1] = people[b - 1 ] = i + 1;
}
for (int j = 0;j < 2 * N ;j++)
{
if (couple.empty())
couple.push(people[j]);
else
{
if(people[j] == couple.top())
couple.pop();
else
couple.push(people[j]);
}
}
if (couple.empty())
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return 0;
system("pause");
}
当我输入0的时候应该是直接停止吧 可是它输出了yes 也就是执行了最后的几行程序