eclipse CDT写c++使用文件作为输入源(输入重定向) 在main函数第一句添加下面。 freopen("inputfile","r",stdin); 创建一个inputfile,放project根文件夹下。 注意添加: #include<cstdio> 做ACM题目的时候实用。