I've been working a program which takes information from a textfile puts it into a vector and once I'm done at the end a function quit_program will save and quit.
I have a function called add_name and delete_name and once I've either added or deleted a name to my vector, I need to take it from the vector and place it into my text file once im finished.
this is my read_file function which reads the text file and puts it into a vector
void add_name(vector<string>&vecThisStudent)
{
//write the body of the function
string strFirstName, strLastName;
cout << "------------------------------------------\n";
cout << "Enter the name to be added (First, Last): ";
cin >> strFirstName >> strLastName;
vecThisStudent.push_back(strFirstName + " " + strLastName);
cout << " -----Name '" << strFirstName << " " << strLastName << " ' has been added.\n";
}
and here is my quit_program function which save and quits
1 2 3 4 5 6 7 8 9
void quit_program(string strFileName, vector<string>&vecThisStudent)
{
//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;
}