Word wheel: Difference between revisions
Content added Content deleted
(New post which does not use external libraries, in addition to an existing post which uses the "Boost" library.) |
m (Changed two variable names.) |
||
Line 1,166: | Line 1,166: | ||
} |
} |
||
for ( const std::string& |
for ( const std::string& correct_word : correct_words ) { |
||
std::cout << |
std::cout << correct_word << std::endl; |
||
} |
} |
||
Line 1,192: | Line 1,192: | ||
bool valid_word = true; |
bool valid_word = true; |
||
for ( const char& ch : word ) { |
for ( const char& ch : word ) { |
||
std::vector<char>::iterator |
std::vector<char>::iterator iter = std::find(letters.begin(), letters.end(), ch); |
||
int32_t index = |
int32_t index = ( iter == letters.end() ) ? -1 : std::distance(letters.begin(), iter); |
||
if ( index == -1 ) { |
if ( index == -1 ) { |
||
valid_word = false; |
valid_word = false; |