I have a problem with a program i am making. it is a menu with three options. One is writing the needed data to a file and when CTRL+Z is pressed the input should stop. The second is loadin the data from the file and showing it on the screen. The third one is inputting an number and checking it with the rest.
My roblem is that when I try it it breaks after hitting CTRL+Z. When I tried it without a menu it worked but I have to have one. Any ideas on how to fix this.
Bad. The .h headers of the standard library are deprecated and are only there for compatibility issues. Remove the .h for all of those.
void main()
Same. Many modern compilers will simply refuse to compile this. Main should always return an int.
Then, doing it with CTRL+Z (which would -in some but not all OS'es) insert an EOF character into the stream is kind of ugly. Inserting a EOF character will put the stream into fail state, which means all subsequent calls to cin>> will fail automatically without even a check of what's inside. You will have to put