你的代码不能阻止屏幕回显,可以用不缓冲且无回显的getch()实现你的要求int main(){string s;char c = 0;while (1){c = getch(); //使用getch要#includeif (c == '1')break;}cin >> s; //语句3cout << s; //语句4system("pause");}