I posting this message seeking some assistance on an issue I am experiencing. I have been helping a friend with writing C programs as he is currently in school. I have taken C a while ago, and I experienced this same problem. However, I do not remember what the fix is.
Problem:
I am using Borland C++ for my compiler. The programs compile fine with no errors. When I run the program, the screen comes up asking for the user's input. I type the input, press enter, and the screen immediately disappears. When I took the class, I used fflush() or getchar(). I have tried these functions and they don't solve this problem. From previous conversations with more experienced C programmers, I realize that using fflush is not a good programming practice. Therefore, I would rather learn the right way.
Unfortunately, I do not have the code handy to paste into this post, but if you need it, I can certainly add it later this evening. I would like to mention that it does this on all the C programs I have attempted to compile and run on two different high powered computers. If you need any additional information, please let me know.
I am hoping it might just be a setting with the Borland software or some kind of C function I can add that will prevent this from happening.