Merge pull request #957 from eliaskosunen/master

Add braces to for loop in P.1 example
This commit is contained in:
Andrew Pardoe 2017-06-11 18:41:25 -07:00 committed by GitHub
commit 18e8e91745

View File

@ -486,11 +486,12 @@ The second version leaves the reader guessing and opens more possibilities for u
cin >> val;
// ...
int index = -1; // bad
for (int i = 0; i < v.size(); ++i)
for (int i = 0; i < v.size(); ++i) {
if (v[i] == val) {
index = i;
break;
}
}
// ...
}