What I'm guessing is, your output on the first program, looks like this.. TesPress any key to continue
All the escape code '\b' does, is moves the cursor back one space, it doesn't remove text from the screen. So all that is happening is the cursor was moved back one space before the text of "Press any key.. " was displayed, wherein the second program just has the cursor moving back one, then a newline. To actually remove the text, you need a space after the '\b', as cout << "\b ";