Skip to content

Commit 32c6d71

Browse files
committed
Update chapter 7 listing numbers
1 parent e2c46fb commit 32c6d71

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

Chapter7/Smash.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void smashing::simple_answer_smash(
104104
}
105105
}
106106

107-
// Listing 7.12 Better answer smash game
107+
// Listing 7.14 Better answer smash game
108108
void smashing::answer_smash(
109109
const std::multimap<std::string, std::string>& keywords,
110110
const std::multimap<std::string, std::string>& dictionary)
@@ -127,7 +127,7 @@ void smashing::answer_smash(
127127
std::string answer = word.substr(0, offset) + second_word;
128128
std::string response;
129129
std::getline(std::cin, response);
130-
if (response == answer)
130+
if (str_tolower(response) == answer)
131131
{
132132
std::cout << "CORRECT!!!!!!!!!\n";
133133
}

Chapter7/main.cpp

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,7 @@ std::pair<std::string, int> find_overlapping_word_v1(std::string word,
2828
return std::make_pair("", -1);
2929
}
3030

31-
// Listing 7.12 A fake generator for testing // TODO did just return 0
32-
struct FakeGen
33-
{
34-
int x = 0;
35-
using result_type = unsigned;
36-
result_type operator()() {
37-
return x;
38-
}
39-
static constexpr result_type min() { return 0; }
40-
static constexpr result_type max() { return 10; } // TODO hmmm maybe template too?
41-
};
42-
31+
// Listing 7.13 Test properties
4332
void check_properties()
4433
{
4534
using namespace smashing;
@@ -86,6 +75,7 @@ void check_properties()
8675
{ "vector", ""},
8776
};
8877

78+
// Listing 7.12 A fake generator for testing
8979
auto select_first = [](auto lb, auto ub, auto dest) {
9080
*dest = *lb;
9181
};

0 commit comments

Comments
 (0)