that part just means that if you hit enter without entering in any values or characters or anything, it will be invalid input as well. cin >> f1 won't catch you if you just hit the enter key. it just waits for more input. so you need that extra check (cin.get() != '\n') to see if the user just hits enter.