- 博客(13)
- 资源 (8)
- 收藏
- 关注
原创 实参和形参的区别。
它们两个从本质上来说是不同的,形参的本质是一个名字,不占用内存空间;实参的本质是变量,已经占用了内容空间。 传值: 在函数中修改形参并没有改变实参本身的值,只是在改变实参的副本; 传址: 传到函数中的是指向实参地址的指针,此时的修改会同时修改实参本身。
2014-11-30 16:24:09 732
原创 C++Primer4.32练习题
vector ivec(5); vector::size_type cnt = ivec.size(); for (vector::size_type ix = 0; ix != ivec.size(); ++ix,--cnt) { ivec[ix] = cnt; //ivec[++ix] = --cnt; } 注释fby
2014-11-13 21:58:10 315
原创 C++Primer4.8练习。
#include #include #include #include #include #include #include using namespace std; int main() { vector test = { 1, 101, 33, 29, 20, 100 }; auto be = test.begin(); auto en = test.end(); fo
2014-11-10 22:43:22 451
原创 C++Primer3.6练习题。
#include #include #include #include #include #include #include using namespace std; int main() { int multiply_ele[2][5] = { { 1,-1 ,-2,-3,-7}, { 2,3,4,5,6 } }; int *p = multiply_ele[0]; //c
2014-11-09 11:42:02 543
原创 C++Primer3.5.3练习题。
#include #include #include #include #include bool is_equal(int a1[], int a2[]); using namespace std; int main() { int num[3] = {}; int num_2[3] = {}; vector vec_1 = { 1, 2, 3 }; vector vec_
2014-11-07 22:12:44 605
原创 C++Primer3.4.2练习题。
#include #include #include #include #include using namespace std; int main() { vector number(6); number = { 1, 2, 3, 4, 5, 6 }; // 将number的元素按照顺序,从前向后,分别进行相加 //for (auto beg = number.begin()
2014-11-05 22:12:28 552
原创 LUA简单迭代循环。
local one_ = {1,200,300,004,50,6,-1}; for count,number in pairs(one_) do print("number = "..number..",count="..count); end function iterator(it) local num = 0; return function() num = num
2014-11-05 13:37:19 764
原创 C++Primer3.4.1练习题。
#include #include #include #include #include using namespace std; int main() { vector text(3, "csdn"); for (auto it = text.cbegin(); it != text.cend()/* && !isspace(*it)*/; it++) { cout s
2014-11-04 22:45:36 594
原创 C++Primer3.3.3节练习题。
#include #include #include #include #include using namespace std; int main() { vector vc_str; string temp; while (temp != "-1") { cin >> temp; if (temp == "-1") break; vc_str.pus
2014-11-04 00:08:54 492
原创 C++Primer3.3.2练习题。
#include #include using namespace std; int main() { vector vc1; for (int i = 0; i<3; i++) { vc1.push_back(i); } vector vc2 = { "c", "s", "d", "n" }; vector vc3; for (int j = 0; j < vc2.si
2014-11-03 22:38:07 550
原创 C++Primer3.3.1练习题。
int main() { vector> ivec; //vector svec = ivec; // wrong vector svec(10, "null"); vector v1; cout << "v1.size" << v1.size() << endl; vector v2(10); cout << "v2.size" << v2.size() << endl;
2014-11-03 22:17:26 555
原创 C++Primer第3章3.2.3练习。
#include #include using namespace std; int main() { string str("mengjiangtao"); for (char &i : str) { i = 'X'; cout << i; } cout << endl; std::cout << str << endl; string s; cout << s[
2014-11-02 20:40:02 659
另类俄罗斯方块
2016-05-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人