我需要让我的while
循环工作,直到按下键盘上的 ESC 按钮。
char choose = NULL;
while( choose != 27)
{
cout << "Choose (s), (e) or (n): ";
cin.ignore();
choose = cin.get();
switch(choose){
case 's': {SortRoutesByStartPoint(routeList, n); ShowRoutes(routeList, n, "Sorted list (s):"); break;}
case 'e': {SortRoutesByEndPoint(routeList, n); ShowRoutes(routeList, n, "Sorted list (e):"); break;}
case 'n': {SortRoutesByNumber(routeList, n); ShowRoutes(routeList, n, "Sorted list (n):"); break;}
default: {cout << "Not found\n\n"; break;}
}
}
但是当我按下 ESC 按钮时,它什么也没有发生。为什么?
如何让它发挥作用?