Hi,
I start with code:
int main()
{
Dict d;
int n;
std::cin >> n;
char word[100];
for (int i = 0; i < n; i++)
{
std::cin >> word;
d.addWord(word);
}
d.addWord("dog");
d.addWord("drog");
....
return 0;
}
I don't know why when I call method addWord manually, i.e. calls d.addWord("dog") or d.addWord("drog") it works good. But when I try to input data during program work (std::cin>>word) it stores only my last put word.
For example if i try to input words: car, train, bus and later words dog and drog are added, program after taking some operations, returns vector of these words, so it should look like :car, train, bus, dog, drog
and I get bus,bus,bus,dog,drog.
Method addWord takes as an argument pointer Word* w
(Word is class created by mine). I suppose that I do something wrong on input, because I tested program earlier with fixed data and it worked alright.