0

this is an unusual error, but maybe if the code presented here it's easier to recognize?!

void sLetter(Word_store& s)
{
    for ((s.words_input)::iterator it = (s.words_input).begin();
         it != (s.words_input).end(); ++it)
        tolower(*it);

    (s.sWords).push_back(s.words_input);

    return;
}

the function is aim to converting each character in a string from a member of Word_store into lowercase letter.

struct Word_store
{
    std::string words_input;
    std::vector<std::string> Words, CWords, sWords;
};

above code is obvious, but the question is why this error occured?

error: expected ';' before '::' token.
error: 'it' was not declared in this scope.
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by Vasthor
2

error: expected ';' before '::' token.

You have to get the iterator from the class, not an instance. Try this:

for (std::string::iterator it = (s.words_input).begin();

error: 'it' was not declared in this scope.

This one disappears once you fix the above problem.

Votes + Comments
thnx
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.