在VS代码中调试C ++时,不接受终端中的用户输入

时间:2020-08-31 08:45:51

标签: c++ visual-studio-code cin vscode-debugger

我正在使用VScode用C ++编写程序,该程序需要来自用户的输入(使用import itertools filename = "mywordlist.txt" adj = ["united", "dramatic", "green"] noun = ["ladder", "axe", "tiger"] num = [str(i) for i in range(4)] # from '0' to '3' num.insert(0, "") total_list = [adj, noun, num] with open(filename, "w") as fp: for i in itertools.product(*total_list): combined_word = " ".join(i) print(combined_word) fp.write(combined_word) fp.write('\n') ),然后在程序的其他位置使用此值。

当我编译并运行代码时,一切正常,但是当我运行调试器(我使用的是Microsoft C ++编译器和调试器cl.exe,而不是g ++和gdb)时,程序将运行到{{1} }命令,然后停止从用户那里获取值。

当我尝试在调试控制台中键入一个值时,什么也没有发生,并且执行保持暂停状态。 (在所附图片中,我尝试输入5次3次,但没有用。)

1

我在文档中找不到有关此问题的任何内容,所以任何人都可以帮忙吗?

谢谢。

0 个答案:

没有答案