摘要: (a)Node *p0=new Node('0'); Node *p1=p0 -> next=new Node('1');(b)Node *p0=new Node('0'); Node *p1=new Node('1',p0); Node *p2=p1;(c)Node *p0=new Node('0'); Node *p1=p0 ->next=new Node('1'); Node *p2=p1 ->next=new Node('2',p1); 阅读全文
posted @ 2013-09-05 17:59 傻蛋蛋 阅读(68) 评论(0) 推荐(0)
摘要: 1.指针处理数组数组中下标为i的元素就是*(数组名+i),例如*array就是array【0】,*(array+3)就是数组元素array【3】。2.指针数组数组的每个元素都是指针变量,则此数组为指针数组3.指针作为函数参数指针作为函数参数有3个作用(1)使实参与形参指向共同的内存空间,达到参数双向传递的作用(2)减少函数调用时数据传递的开销(3)通过指向函数的指针传递函数代码的首地址4.指针型函数当一个函数的返还值是指针时,这个函数就是指针型函数。目的是在函数结束时把大量数据从被调函数返还给主调函数。5.函数指针函数指针是用来存放函数代码的首地址的指针变量。6.对象指针可以通过对象指针名-& 阅读全文
posted @ 2013-09-04 20:31 傻蛋蛋 阅读(189) 评论(0) 推荐(0)
摘要: #includeusing namespace std;const int maxqueue = 10;class Queue{public:Queue( );bool empty( ) const;Error_code serve( );Error_code append(const Queue_entry item);Error_code retrieve(Queue_entry item) const;protected:int front,rear;Queue_entry entry [maxqueue];bool is_empty; };Queue :: Queue( ){rear 阅读全文
posted @ 2013-08-29 18:23 傻蛋蛋 阅读(167) 评论(0) 推荐(0)
摘要: Error_code copy_stack(Stack &dest,Stack &source){ Error_code detected=success; Stack temp; Stack_entry item; while(detected==success&&!source.empty()}{ detected=source.top(item); detected=source.pop(); if(detected==success)detected=temp.push(item); }while (detected==success&& 阅读全文
posted @ 2013-08-29 18:22 傻蛋蛋 阅读(100) 评论(0) 推荐(0)
摘要: (a) 当n=3时,有五种 123, 132, 213, 312, 321 (b)当n=4时,有14种 1234, 1243, 1324, 1423, 1432, 2134, 2143, 3124, 3214, 4123, 4132, 4213, 4312, 4321 阅读全文
posted @ 2013-08-25 20:35 傻蛋蛋 阅读(128) 评论(0) 推荐(0)
摘要: 1.大型程序的问题 problems large programs2.问题说明 problem specification3.程序设计 problem design4.数据结构的选择 choice of data structures5.算法分析 analysis ofalgorithms6.测试和验证 testing and verification7.程序正确性 program correctness8.维护 maintenance 阅读全文
posted @ 2013-08-20 22:34 傻蛋蛋 阅读(83) 评论(0) 推荐(0)