- 博客(8)
- 收藏
- 关注
原创 好吧,上篇是是单向的这篇是双向的
template Error_code List :: remove( int position , List_entry &x) { Node*prior,*current; if (count == 0) return fail ; if (position =count) return range_error ; if (position > 0) { prior= set
2013-09-25 20:13:30
491
原创 list 方法的实现
The constructor List template List :: List( ) { count = 0; } clear template voidList :: clear( ) { count = 0; } empty template boolList :: empty( ) const { return count } full
2013-09-25 19:57:23
512
原创 list remove 方法
template Error_code List :: remove( int position , List_entry &x) { if (count == 0) return underflow ; if (position =count) return range_error ; x = entry[position ]; count −−; while (po
2013-09-25 19:41:53
593
转载 C++指针
什么是指针? 其实指针就像是其它变量一样,所不同的是一般的变量包含的是实际的真实的数据,而指针是一个指示器,它告诉程序在内存的哪块区域可以找到数据。这是一个非常重要的概念,有很多程序和算法都是围绕指针而设计的,如链表。 指针的好处是什么:快效率,省资源。 开始学习 如何定义一个指针呢?就像你定义一个其它变量一样,只不过你要在指针名字前加上一个星号。我们
2013-09-10 21:17:39
362
原创 Exercises 4.1 E2
(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->nex
2013-09-05 18:07:06
387
原创 exercises3.3
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;
2013-08-28 22:48:57
398
原创 exercises2.2
Error_code copy_stack(Stack &dest,Stack &source); { Erroe_code outcome=success; Stack a; Stack_entry item; while( outcome==success&&!source.empty()) outcome=source.top(item); outcome=source.pop
2013-08-28 22:14:44
427
原创 编程原则
1.1 (介绍) 程序设计员的成果所具有的功效就好比是用一张拼凑的被单作为从高楼跳下的人的安全网,网强人安全。 1.2 (life游戏) 一个类的方法是公用的。一个类的函数是私有的。 1.3 (编程设计风格) 为了使程序完善地运行,最重要的是确切地知道每个类和变量代表什么以及每个函数 做什么,吲此一般应该包
2013-08-24 13:48:14
432
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅