C help using txt file Implement the function vector getToke
C++ help :
using .txt file
Implement the function vector<TokenFreq> getTokenFreq( string inFile_name); This function reads the specified input file line by line, identifies all the unique tokens in the file and the frequency of each token. It stores all the identified (token, freq) pairs in a vector and returns this vector to the calling function. Don\'t forget to close the file before exiting the function. In this homework, these tokens are case insensitive. For example, \"Hello\" and \"hello\" are considered to be the same token. (20 points)
Implement the selection sort algorithm to sort a vector<TokenFreq> in ascending order of token frequency. The pseudo code of the selection algorithm can be found at http://www.algolist.net/Algorithms/Sorting/Selection_sort You can also watch an animation of the sorting process at http://visualgo.net/sorting -->under \"select\". This function has the following prototype:
void selectionSort( vector<TokenFreq> & tokFreqVector ); This function receives a vector of TokenFreq objects by reference and applies the selections sort algorithm to sort this vector in increasing order of token frequencies. (20 points)
Implement the insertion sort algorithm to sort a vector<TokenFreq> in descending order of token frequency. The pseudo code of the selection algorithm can be found at http://www.algolist.net/Algorithms/Sorting/Insertion_sort Use the same link above to watch an animation of this algorithm. This function has the following prototype:
void insertionSort( vector<TokenFreq> & tokFreqVector ); (20 points)
Implement the void writeToFile( vector<TokenFreq> &tokFreqV, string outFileName); function. This function receives a vector of TokenFreq objects and writes each token and its frequency on a separate line in the specified output file. (10 points)
Implement the int main() function to contain the following features: (1) asks the enduser of your program to specify the name of the input file, (2) ) call the getTokenFreq() to identify each unique token and its frequency, (3) call your selection sort and insertion sort functions to sort the vector of TokenFreq objects assembled in (2); and (4) call the WriteToFile() function to print out the sorted vectors in two separate files, one in ascending order and the other in descending order. (15 points)
Solution
#include