- 博客(4)
- 资源 (3)
- 收藏
- 关注
原创 C++Primer 中文版第5版 习题3.31/3.32
#include #include using namespace std;int main(){int num[10];int num_cpy[10];for (size_t i = 0; i != 10; ++i){num[i] = i;}for (size_t i = 0; i != 10; ++i){num_cpy[i]
2016-09-20 18:55:29 426
原创 C++Primer 中文版第5版 习题3.26
二分搜索的新中间点的计算公式:mid = beg + (end - beg) / 2 而不是 mid = (beg + end) / 2 ?为了防止在最后的两个数字之中进行查找,不如beg = 6 and end = 7, 用当此时的beg不符合要求时新计算的mid = 7, 而第二种结果是6 这会造成无法更新中间点,永远都找不到结果。
2016-09-20 18:45:42 518
原创 C++Primer 中文版第5版 习题3.23
#include #include using namespace std;int main(){vector vec;for (size_t i = 0; i != 10; i++){vec.push_back(i);}for (vector::iterator it = vec.begin(); it != vec.end();
2016-09-18 23:48:40 257
原创 C++Primer 中文版第5版 习题3.4
#include #include using namespace std;int main(){string str_one, str_two;cin >> str_one >>str_two;if (str_one == str_two){cout }else{cout str_two ? str_one : str_two)
2016-09-14 23:31:20 341
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人