File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ void pennies_game()
46
46
{
47
47
break ;
48
48
}
49
- int player_choice = input.value ();
49
+ const int player_choice = input.value ();
50
50
51
51
++turns;
52
52
std::cout << " You pressed " << player_choice << " , I guessed " << prediction << ' \n ' ;
@@ -125,7 +125,7 @@ class State
125
125
}
126
126
}
127
127
// 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)
129
129
{
130
130
if (auto it = state_lookup.find (key); it != state_lookup.end ())
131
131
{
@@ -298,14 +298,14 @@ void mind_reader()
298
298
std::cout << " and it can now read your mind.\n " ;
299
299
while (true )
300
300
{
301
- int prediction = mr.get_prediction ();
301
+ const int prediction = mr.get_prediction ();
302
302
303
303
auto input = read_number (std::cin);
304
304
if (!input)
305
305
{
306
306
break ;
307
307
}
308
- int player_choice = input.value ();
308
+ const int player_choice = input.value ();
309
309
310
310
++turns;
311
311
std::cout << " You pressed " << player_choice
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ void demo_further_properties()
38
38
std::ranges::transform (triangle_numbers,
39
39
std::back_inserter (odd_or_even),
40
40
[](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, " " ));
42
42
std::cout << ' \n ' ;
43
43
44
44
std::map<int , size_t > last_digits;
You can’t perform that action at this time.
0 commit comments