From 3d85f160de675885c83d4f33ba95ba98a5aa9040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20L=C3=A9onard?= Date: Fri, 24 Jul 2020 21:52:02 +0200 Subject: [PATCH] Update Soln7_03.cpp lower_word was actually a concatenation of the string word and the string word in lower case, leading to wrong result when the search word contained capital letters. --- Beginning C++ 17 source code/Exercises/Chapter 07/Soln7_03.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Beginning C++ 17 source code/Exercises/Chapter 07/Soln7_03.cpp b/Beginning C++ 17 source code/Exercises/Chapter 07/Soln7_03.cpp index 7d63b48..5bee4ed 100644 --- a/Beginning C++ 17 source code/Exercises/Chapter 07/Soln7_03.cpp +++ b/Beginning C++ 17 source code/Exercises/Chapter 07/Soln7_03.cpp @@ -15,7 +15,7 @@ int main() std::cout << "\nEnter the word to be replaced: "; std::cin >> word; - std::string lower_word{word}; // Convert word to lower case + std::string lower_word; // Convert word to lower case for (auto ch : word) // (we do so once, rather than with every iteration of the loop) lower_word += std::tolower(ch);