下面的這個程序,如果將那個string定義為new 的話,會出現(xiàn)很多錯誤,一定要注意啊?。?br>
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
using namespace std;
int main()
{
vector<string> v;
string line;
ifstream in ("1.cpp");
while (getline(in,line))
{
v.push_back(line);
}
string test;
for (int i = 0; i != v.size(); i++)
{
test = test + v[i];
}
cout << test;
return 0;
}
posted on 2009-11-27 21:39
deercoder 閱讀(288)
評論(0) 編輯 收藏 引用 所屬分類:
編程體會和收獲