你好!!
数据文件保存在,a.txt 里面
#include#include#includeusing namespace std;int main(){ string a1; int i=0; ifstream inFile; inFile.open("a.txt"); while(!inFile.eof()) //读开始 { i++; getline(inFile,a1); cout<< i << " " < } inFile.close(); return 0;}