PROGRAM:
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
vector<string> vec(20);
vector<string>::iterator it;
int main() {
ifstream infile("Transaction.txt");
string line;
while(getline(infile,line))
{
istringstream iss(line);
string command;
iss>>command;
if(command == "Add")
{
string word;
int position;
iss>>word>>position;
vec.insert(vec.begin() + position, word);
}
else if(command == "Remove")
{
int position;
iss>>position;
vec.erase(vec.begin() + position);
}
else if(command == "Print")
{
for (vector<string>::const_iterator i = vec.begin(); i != vec.end(); ++i)
{
if(*i != "")
{
cout << *i << "\n";
}
}
}
}
return 0;
}