我要做的就是将 readme.txt 的内容打印 20 次。请帮忙。
int main()
{
ifstream myfile;
string line;
int i;
myfile.open ("readme.txt");
if (myfile.is_open()){
while (i<20){
i++;
if(!myfile.eof()){
cout << "asdasd" << "\t";
myfile.seekg(0, ios::beg);
}
getline (myfile,line);
cout << line << endl;
}
cout << endl;
myfile.close();
}
else cout << "Unable to open file";
return 0;
}