为了加快输入速度,我看到你可以使用文件重定向
并包含一个已经设置好cin
输入的文件。
理论上它应该像以下这样使用:
App.exe inputfile outputfile
据我理解C++ Primer书籍所述,以下C++代码[1]应该从文本文件中读取cin
输入,并且不需要其他特殊的指示[2]。[2]
include <fstream>
ofstream myfile;
myfile.open ();
[1] 以下是 C++ 代码...
#include <iostream>
int main()
{
int val;
std::cin >> val; //this value should be read automatically for inputfile
std::cout << val;
return 0;
}
我有什么遗漏吗?