Hello, I'm studying from Bjarne's "PROGRAMMING Principles and Pratice Using C ++" book. I'm trying to make Drill number 1 from chapter four. The exercise says to do a program that consists of a while-loop that reads and prints two integers and stops when it is written |, but when I write | (or anything other than a number) the program sits in an infinite loop. If someone can explain to me what is wrong with my code, I have already tried to read it in the book about conversions from int to char and vice versa and still the error persists, take a look.
#include <...\Projects\std_lib_facilities.h>
int main()
{
//drill's
//1 - inicio
/*escrever um programa que consiste em um while-loop que leia dois int e termine quando
é escrito | */
int n=0, n1=0;
cout << "Write a int. To stop the program hit |";
while (n != '|' || n1 != '|' )
{
cin >> n >> n1;
system("cls");
cout << n << " " << n1 << "\n";
}
}