Skip to content

Commit 2f683d6

Browse files
committed
Add a couple of consts after reviewing the final proofs
1 parent edf4d5f commit 2f683d6

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Chapter8/main.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void pennies_game()
4646
{
4747
break;
4848
}
49-
int player_choice = input.value();
49+
const int player_choice = input.value();
5050

5151
++turns;
5252
std::cout << "You pressed " << player_choice << ", I guessed " << prediction << '\n';
@@ -125,7 +125,7 @@ class State
125125
}
126126
}
127127
// Listing 8.9 Update choices for valid keys
128-
void update(const state_t& key, const Choice turn_changed)
128+
void update(const state_t& key, const Choice& turn_changed)
129129
{
130130
if (auto it = state_lookup.find(key); it != state_lookup.end())
131131
{
@@ -298,14 +298,14 @@ void mind_reader()
298298
std::cout << "and it can now read your mind.\n";
299299
while (true)
300300
{
301-
int prediction = mr.get_prediction();
301+
const int prediction = mr.get_prediction();
302302

303303
auto input = read_number(std::cin);
304304
if (!input)
305305
{
306306
break;
307307
}
308-
int player_choice = input.value();
308+
const int player_choice = input.value();
309309

310310
++turns;
311311
std::cout << "You pressed " << player_choice

Chapter9/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void demo_further_properties()
3838
std::ranges::transform(triangle_numbers,
3939
std::back_inserter(odd_or_even),
4040
[](int i) { return i % 2 ? '.' : '*'; });
41-
std::ranges::copy(odd_or_even, std::ostream_iterator<char>(std::cout, ""));
41+
std::ranges::copy(odd_or_even, std::ostream_iterator<char>(std::cout, " "));
4242
std::cout << '\n';
4343

4444
std::map<int, size_t> last_digits;

0 commit comments

Comments
 (0)