detectar el final de la entrada del usuario CPP

while (cin.peek() != EOF) {
  // To do your stuff...
  // NOTE: peek() will set failbit when peeking end of stream and return EOF(-1).
}
Hilarious Hippopotamus