visual-studio - Visual Studio C++ Console调试过程中,有哪些手段可以将要输入的参数,事先存好读进去,而不用手工敲键盘输入
迷茫
迷茫 2017-04-17 13:30:26
0
5
457

Visual Studio C++ Console调试过程中,有哪些手段可以将要输入的参数,事先存好读进去,而不用手工敲键盘输入?

更新:提这个问题主要是好奇,那些OJ的系统,是怎么对代码进行评测的。
代码里都是cin这样的输入,那么OJ是怎样来用自己的case来评测这些代码是否正确呢?

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(5)
洪涛

Add header file fstream

at the beginning
#include<fstream>

Then, put the data you want to lose in in.txt, and add

in the code
std::ifstream cin("in.txt");

Just follow the normal usage of cin later.

阿神

Called through code, haha

迷茫

Fill in the parameters you want to enter directly in the main function and that’s it. . .
There are many methods.

伊谢尔伦

type yourtext.txt | yourexe.exe

左手右手慢动作

An alternative, unit testing

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template