|
|
|
|
return true;
is inside the for loop, after your if statement. Oops.I would recommend using two vectors. Via a for loop, check each word (a word is a piece of text surrounded by whitespaces). If a word is encountered hasn't been stored in vector 1, add it to vector one using push_back, and then add a counter to vector 2 that will indicate the number of times the word in the same position in vector one has been found. If a word that is already in vector 1 has been found, increment the respective integer in vector 2 by one. When you get to the end, read out both vectors using a for loop. -Albatross |
Your return true; is inside the for loop, after your if statement. Oops. -Albatross |
Runtime errors are much more annoying.... by the way, where is your second vector? And what is the runtime error? -Albatross |
|
|