糟糕的链表例子
来源:互联网 发布:电影英语台词软件 编辑:程序博客网 时间:2024/05/16 05:21
没有修改。有时间再改
#include <iostream>
using namespace std;
class listnode
{
public:
intm_node ;
listnode* next;
public:
listnode(){}
~listnode(){}
};
class list
{
public:
listnode * first;
list() { first = NULL ;}
~list(){}
//insert();
void insert_front( int node );
//insert_back(int node );
//length();
//remove();
void print( void );
listnode* CreateNode(int n);
};
listnode* list::CreateNode(int n)
{
listnode* temp = new listnode;
temp->m_node= n;
temp->next= NULL ;
return temp;
}
void list::insert_front( int node )
{
listnode* temp;
temp=CreateNode( node );
if ( first->next != NULL )
{
temp->next = first->next;
}
first->next = temp ;
}
//list::insert_back( int node )
//{
//
//}
void list::print( void )
{
listnode* temp = first;
while ( temp )
{
cout<< temp->m_node<<endl;
temp = temp->next;
}
}
void main(void)
{
list* head = new list;
head->first = new listnode;
head->first->next=NULL;
for (int i=1 ; i< 10 ; i++)
{
head->insert_front(i);
}
//head->print();
listnode* temp = head->first;
while ( head->first->next )
{
cout<< head->first->next->m_node<<endl;
head->first->next = head->first->next->next;
}
}
- 糟糕的链表例子
- 《javascript语言精粹》闭包一个糟糕的例子解惑
- 糟糕的情绪;糟糕的火箭
- 糟糕的开始并不会糟糕结束
- 一个C++程序重构的例子——糟糕的代码
- 糟糕的一天
- 糟糕的食物
- 糟糕的一天
- 糟糕的三个月
- 糟糕的十二月始
- 糟糕的早上~~~~
- 记住糟糕的过去
- 记住糟糕的过去
- 记住糟糕的过去
- 记住糟糕的过去
- 糟糕的大学计算机教育
- 记住糟糕的过去
- 记住糟糕的过去
- Tortoise SVN中文件修改后,上级文件夹图标不变,始终显示未修改
- 取时间 做随即数
- quartz 配置文件说明(转贴)quartz 配置文件说明(转贴)
- 打包带sqlServer数据库方法
- sqlserver小技巧
- 糟糕的链表例子
- 求生存,求发展!
- ADO.NET-插入多条记录(用SqlBulkCopy类)
- Spring-mvc-jdbc知识点小结
- wince串口数据“丢失”,SetCommState设置失败
- 如何实现多进程写一个文件
- SQL优化34条
- 混合高斯背景建模
- sqlserver 2005局域网连接不上 解决