so here's the code:
#include <iostream>
#include "Trie.h"
using namespace std;
void main()
{
string input;
Trie dictionary('\0');
while (true)
{
getline(cin, input);
if (input[0] != '.')
{
dictionary.analyzeText(input);
}
}
cout << endl;
while (input[0] != '.')
{
getline(cin, input);
dictionary.analyzeTextP2(input);
}
system("pause>null");
}
It's not final version but when I enter an input such as:
The quick brown fox
totally jumper over
the lazy
terrier dog
.
The .
in the last line should be the mark to finish getting an input from user, however getline
doesn't get it at the fifth iteration, no idea why.
I've made sure that textAnalyze()
function doesn't interact with the fifth line.
So, how come the .
gets swallowed or what's causing it? (and I know I need a break;
in the first loop, it's okay)