c++读文件时怎么跳过前两行再存入数组里啊
我给你写个例子:
#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream file;
int i=0;
file.open("C:/Users/Lenovo/Desktop/1.txt", ios::in);
string buf;
while (getline(file,buf))
{
if(i<2){
i++;
continue;
}
cout << buf << endl;
}
}