Why cin.get() is also wrong for this code as cin.getline()?