123456789101112 |
- /* Create a function that takes a word
- ~ and returns true if the word has two consecutive identical letters.
- */
- bool double_letters(std::string word) {
- for (int i=0;i<word.size();i++){
- // get current character of "word", compare with next character
- if (word[i] == word[i+1]) {
- return true;
- }
- }
- return false;
- }
|