The C++ program should exit as soon as he presses 'esc'

Viewed 12129

I have a program in which there is a code which looks something like this:

int Element[15];
cout << "Enter name/symbol of the Element: ";
cin >> Element;

and I want the program to exit as soon as he presses 'esc' key. And also the user should not have to press the 'enter' key after pressing the 'esc' key. So how to do that??

1 Answers
Related