如何在Visual Studio Code中放置自定义输入以进行调试 [英] How to put custom input for debugging in Visual Studio Code
问题描述
在Visual Studio代码中,我不想每次都对程序进行长时间输入.有没有办法像在hackerearth中复制粘贴我的输入内容一样,程序将在其上运行.
In Visual studio code , i dont want to give long input to my program everytime. Is there a way like in hackerearth to copy paste my input and the program will run on them.
以这个为例,我应该在launch.json的args中写些什么.我是vscode的新手.这是我的程序
Take this as example.What should i write in args of launch.json. I am new to vscode.Here is my program
推荐答案
您必须按如下所示更改main():
You have to change the main() as below:
int main(int argc, char* argv[])
{
for(int i = 1; i <argc; ++i)
std::cout<<argv[i];
return 0;
}
这是简单的程序.
您必须右键单击项目,选择属性",然后转到调试"部分-命令参数"框存在. 将其指定为"34 45 44".
You have to right-click the project, choose Properties, go to the Debugging section -- there is a box for "Command Arguments". Specify the as "34 45 44".
您只需提及一次即可一次又一次地运行它.
You can run this again and again by mentioning it once.
这篇关于如何在Visual Studio Code中放置自定义输入以进行调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!