第1个回答 2017-01-07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main(){
fstream input;
string str[50];
int i=0,j;
input.open("1.txt");
while(!input.eof()){
getline(input,str[i]);//将一行的内容全部读入
i++;//记录行数
}
input.close();
for(j=0;j<i;j++){
cout<<str[j]<<endl;
}
return true;
}本回答被提问者采纳