用C++怎么读取txt文件 并能够只用文件中的内容
希望能举个例子
2012-02-10 20:06
2012-02-10 22:54
2012-02-11 10:18
程序代码:#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream in("abc.txt");
string line;
int num = 0;
while (getline(in, line))
{
cout << ++num << "\t:" << line << endl;
}
return 0;
}
2012-02-11 22:26
2013-12-26 14:15