hi everyone, i dont know what is the problem of my code. here is the code...
this is my .h
Code:
#include <string>
#include <iostream>
#include <vector>
#include "stringset.h"
using namespace std;
class InvertedIndex
{
//insert data member here
struct inputType
{
string word;
string file;
};
vector<inputType> list;
public:
// Tally adds one word/file pair to the index
void tally(string word, string file);
and this is my implementation file
Code:
#include "inverted_index.h"
#include "osdir.h"
// InvertedIndex::tally
// Pre: a word and file pair as strings
// Post: adds the file to the index under word
void InvertedIndex::tally(string word, string file)
{
inputType input;
list.push_back( input );
}
and this is my main code
Code:
#include "inverted_index.h"
int main()
{
// test the InvertedIndex
InvertedIndex idx;
idx.tally("cat", "cats.txt");
idx.tally("cat", "animals.txt");
idx.tally("cat", "everything.txt");
idx.tally("dog", "dogs.txt");
idx.print();
the purpose of the program is to insert the string which i decalre it to string word and string file . but when i push_back to vector.. and display it... there are empty in vector....
can someone let me know what is wrong with the code please...
will highly appreciated...