How to put custom input for debugging in Visual Studio Code

房东的猫 提交于 2020-04-18 12:35:41

问题


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.

Take this as example.What should i write in args of launch.json. I am new to vscode.Here is my program


回答1:


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;
}

This is simple program.

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.



来源:https://stackoverflow.com/questions/60702210/how-to-put-custom-input-for-debugging-in-visual-studio-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!