I'm working on an assignment for my computer science class, its a first year course as I'm a beginner and I am having trouble with a certain part.

A quick explanation of what my assignment does is:
It takes information from a text file and puts it in a vector while the program is running, and you can add names to it or remove names from it, and once you are done you need it to save the information, which means you have to take the information back out of the vector and replace it into the text file.

I haven't learned of a way to take information out of a vector and back into a text-file, I saw that a classmate of mine posted on here a few times but he was pretty much dismissed so he told me to ask the question for myself.

We were given a bit of the coding for our program and honestly I have got no clue on how to make the function take the information back out of the vector and into the text file updated.

What ive included:

```
#include <iostream>
#include <string>
#include <vector>
#include <fstream>

```

here is the function in which it would save into, any help would be greatly appreciated.

```
void quit_program(string strFileName, vector<string>&vecThisStudent)
{
//write the body of the function
//Hint: this is the function you should write the vector’s content back to the file.

cout<<"Thanks for using the program. Program terminated"<<endl;
}

```

As you can see we were even given the hint on what the function was supposed to do, but anyone I have spoken to from the class hasnt had a clue on how to get it done (or they dont like me enough to tell me) 

If the entire program is needed, I can post it. It looks almost identical to my classmate who posted earlier, but that is just because we were given the majority of the code and we just had to complete a few different things, and I've just been stuck here for the last 10 hours or so.

My read\_file 

```
int read_file(string strFileName, vector<string>&vecThisStudent, fstream &inFile)
{

string strFirstName
    string strLastName;

inFile.open(strFileName.c_str(), ios::in | ios::out | ios::app);

while (inFile >> strFirstName >> strLastName)
{
    vecThisStudent.push_back(strFirstName + " " + strLastName);
}

return 0;
}

```