my text file is in this format
Code:
studentName Student Name One FatherName Father Name of Student One separator studentName Student name Two FatherName Father name of Student Two separator studentName Student Name three FatherName Father Name of Student three separator studentName Student name four FatherName Father name of Student four
here is my code so far
Code:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <fstream>
using namespace std;
int main()
{
vector<string> v1;
vector<string> v2;
string line;
ifstream in("names.txt", ios::in);
while(!in.eof()) {
getline(in, line);
v1.push_back(line);
}
//cout << v1.size();
copy(v1.begin(), v1.end(), v2.begin());
int ii;
for(ii = 0; ii < v2.size(); ii++) {
cout << v2[ii];
}
system("pause");
return 0;
}
Code:
Debug assertion failed Expression: vector iterator + offset out of range
