I'm trying to make a vector of pairs from a text that looks something like that:
line1
line2
line3
And the vector would contain a pair of line1 and line2.
And another vector would contain line1 and line3
Normally I would add lines to a vector like this
vector<string> vector_of_text;
string line_of_text;
ifstream test_file("test.txt");
if(test_file.is_open()){
while(getline(test_file, line_of_text)){
vector_of_text.push_back(line_of_text)
}
test_file.close();
}
but I don't know if it is possible to access the next line of text with the getline command.
For example, in an array, I would do i+1 or i+2 for the next or 3rd element.
I was wondering if there was a way to do that with getline.