类似这样:
#include #include void shutdown(){ char type; printf ("您确定退出吗?(Y/N)"); fflush(stdin); scanf ("%c", &type); if (type=='Y' || type=='y') exit(0);}int main(){ int a; while (scanf ("%d", &a)!=EOF){ if (a==4){ shutdown(); } } return 0;}