Just do
int i,j;
std::string line;
while(std::getline(cin,line) && !line.empty()){
std::istringstream iss(line);
if(iss >>i>>j) {
//LOOP BODY
}
}
2
solved how to check if int input is empty or user pushed enter key in a while loop C++