我有点喜欢 CodePad 在线编辑器(支持 C++),但我想使用一些 scanf,而这在 CodePad 上不可能。
是否有一些支持输入流的在线 C++ 编译器?这是否可能?
IDEOne 支持传递输入;您可以在 <textarea>
中指定它。
[免责声明:我更喜欢ideone.com(也支持c++0x)]
非常严谨地说,您可以通过使用以下恶劣的技巧将输入放入源文件中:
/* just skip the first two (!!!) lines when reading from t.cpp
602.030024387
423.927317911
520.43881927
131.655014874
35.7455352247
548.735653436
714.556123804
876.948673754
379.105540406
885.096900058
192.734103705
116.365922766
363.998415895
216.268387112
958.684513705
*/ // end of fake input
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
std::ifstream ifs("t.cpp");
std::cout << ifs.rdbuf() << std::flush;
}
fopen()
等? - toficofiinput1
<TESTCASE>
input2
<TESTCASE>
....
关于输入流的可能性:没有人会自己构建编译器。每个人都使用一些标准,如后端中的gcc。所有在线编译器网站都围绕以下流程进行架构(例如:C ++):
1) read_code_user
2) Save it as variablename.cpp
3) Use a queuing framework. Then execute g++ variablename.cpp. Further, various libraries are utilized which can pipe stdin, stdout and stderr.
scanf()
。 - user31782