There's no real reason beyond "that's how it works". You can just press F6 instead though. That will be seen as signaling the end of file, even if it's not preceded by an enter.
The reason you have to press both F6 and enter is fairly simple: there are really two separate pieces of code involved here. The operating system has a small (somewhat crippled) editing routine that lets you enter a line of data. It has code to process back-space and a few things like that, so you can use them when entering data, even though your code doesn't include any editing capability at all. That routine returns a line of text to your program, but only when you've entered what it is programmed to "think of" as a completely line--and that only happens when enter is pressed.
Once that buffer full of data has been read in by the operating system, it's sent to your program. Your program looks at the contents, and when/if it finds the ctrl+Z, it reads that as signaling the end of the file. But, since the end of file processing is done by your program, not the operating system's editing routine, there's no way for it to be senses until you've pressed enter.
If you really don't like this behavior, most operating systems do provide some way to do un-buffered reading. The exact way varies by operating system though. One Windows, you can use _getch. Most Unix-based systems provide roughly the same capabilities in the Curses library (and if you want to use that, there's also at least one free implementation of curses for Windows).