About the double cout, I'm guessing that the input stream still has some junk in it from the last time cin was called. So line 5 ends up not waiting for new input until the loop runs an extra time. Try placing cin.ignore(80,'\n'); just before line 5 and see if that fixes it.