不用这么麻烦 #include #include int main() { char ch; while(1) { printf("感谢您的使用,再体验一次请选择1, 按任意键退出^_^\n"); fflush(stdin); // 清空输入缓冲区 if(getch() == '1') // 按1继续执行循环 { // 此处填写需循环执行的代码 } else break; // 按除1的任意键退出循环 } }