C++读取txt文件
------------恢复内容开始------------
#include <iostream> #include <string> using namespace std; int main() { string line; while (getline(cin, line)) { cout << line; } return 0; }
运行结果:
需要将txt文档和编写的程序放在同一个文件夹中
------------恢复内容结束------------