Skip to content

Commit

Permalink
Update ex5_17.cpp
Browse files Browse the repository at this point in the history
move the { if (i == size - 1) cout << "true" << endl; } out of the 'for' loop. There is no need to judge if (i == size - 1) every time.
  • Loading branch information
Subenle committed Aug 21, 2016
1 parent ab55afb commit e531288
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ch05/ex5_17.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ int main()
for (decltype(vec1.size()) i = 0; i != size; ++i) {
if (vec1[i] != vec2[i]) {
cout << "false" << endl;
break;
return 0;
}
if (i == size - 1) cout << "true" << endl;
}

cout << "true" << endl;
return 0;
}

0 comments on commit e531288

Please sign in to comment.