The C++ programming language is useful for programming desktop applications and operating systems. C++ works well as a tool when speed and low-level hardware management is required. When receiving user input from a terminal application, the input command for C++ will halt when receiving an “EOF” signal. Using this, you can check whether or not a user clicks the key combination of “Ctrl” and “D.” using namespace std; int main(){ return 0; } int main(){ int x = 0; while (cin » x){ } return 0; } int main(){ int y = 0; while(cin » y ){ cout « y; } if (cin.eof()){ //checks for Control-D / EOF cout « “yup”; priants only if cin hits EOF through Control-D } return 0; } Writer Bio

How to Check for Ctrl D in C   - 76