讀寫文檔
#include<fstream>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
ifstream in;
ofstream out("d:\\csq\\answer.txt");
string s;
int i;
vector<string> a;
in.open("d:\\csq\\data.txt");
if(!in)
{
cout<<"not open file\n";
return 0;
}
while(getline(in,s))
{
a.push_back(s);
}
in.close();
? ??
for(i=0;i<a.size();i++)
{
s=a[i];
cout<<s<<endl;
out<<s<<"="<<100<<endl;
}
out.close();
}
標簽: