Alright i have my program and it loads the vector fine and even puts the vector into a txt file but when it comes to lloading it again im not sure if it works or not
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
usingnamespace std;
int main()
{
string input;
vector<string> test;
do
{
getline(cin,input); // Loading the vector with input
test.push_back(input);
}
while ( test.size() < 5 );
for( int i = 0; i < test.size(); i++) // Loading the vector to at txt file
{
fstream inout;
inout.open("Vector.txt", ios::app);
inout << test[i]<< endl;
inout.close();
}
for( int i = 0; i < test.size(); i++)
{
string line;
fstream inout("Vector.txt"); // Loading the vecotr from the txt file
while( !inout.eof())
{
getline(inout,line);
test.push_back(line);
}
inout.close();
}
for( int i = 0; i < test.size(); i++) // Not sure what is happening
{
cout << test[i]<<endl;
}
system("pause");
}