资源简介
通讯录管理系统使用c++编程语言编写,其中文档中包含源码和设计报告 使用顺序表作为存储结构,折半查找,递增排序。
具体的请参考我的csdn博客

代码片段和文件信息
#include
#include
#include
#include
using namespace std;
/* person类
包含人的姓名,城市,电话
*/
class Person
{
private:
string name;
string city;
string phone;
public:
Person(){}
Person(string name string city string phone)
{
this->name = name;
this->city = city;
this->phone = phone;
}
string getCity()
{
return this->city;
}
void setCity(string city)
{
this->city = city;
}
string getPhone()
{
return this->phone;
}
void setPhone(string phone)
{
this->phone = phone;
}
string getName()
{
return this->name;
}
void setName(string name)
{
this->name = name;
}
void update(string name string city string phone)
{
this->name = name;
this->city = city;
this->phone = phone;
}
};
typedef Person ElemType;
typedef int Status;
const int SUCCESS = 1;
const int ERROR = -2;
//定义节点类型
typedef struct DulNode
{
ElemType data[100];
int length;
}DulNode;
//排序
void nodeSort(DulNode &listint localstring oldNamestring newName)
{
int low = 0;
int high = 0;
int mid = 0;
int temp = 0;
if(newName.compare(oldName) <= 0)
{
low = 0;
high = local - 1;
temp = 1; //向左查找
}else
{
low = local + 1;
high = list.length-1;
temp = 0; //向右查找
}
while(low <= high)
{
mid = (low + high) / 2;
if(newName.compare(list.data[mid].getName()) < 0)
{
high = mid - 1;
}else
{
low = mid + 1;
}
}
Person tempPerson = list.data[local];
if(temp == 1) //向右移动
{
for(int j = local - 1 ;j >= high + 1;--j)
{
list.data[j + 1] = list.data[j];
}
list.data[(high + 1)] = tempPerson;
}else
{
for(int j = local + 1 ;j <= high; j++)
{
list.data[j - 1] = list.data[j];
}
list.data[(high)] = tempPerson;
}
}
//插入节点折半插入
Status nodeInsert(DulNode &list Person person)
{
int len = list.length-1;
if(len >= 0)
{
int low = 0; int high = len;
int mid = 0;
while(low <= high)
{
mid = (low + high) / 2;
if(person.getName().compare(list.data[mid].getName()) < 0)
{
high = mid - 1;
}else
{
low = mid + 1;
}
}
for(int j = len;j >= high + 1;--j)
{
list.data[j + 1] = list.data[j];
}
list.data[(high + 1)] = person;
}
else
{
list.data[0] = person;
}
list.length++;
return SUCCESS;
}
//删除节点
Status nodeDelete(DulNode &list string name)
{
if(list.length > 0)
{
int low = 0;
int high = list.length-1;
int mid = (low + high) / 2;
while(low <= high)
{
mid = (low + high) / 2;
if(name.compare(list.data[mid].getName()) < 0)
{
high = mid - 1;
}else if(name.compare(list.data[mid].getName()) > 0)
{
low = mid + 1;
}
else
{
for(int i = mid + 1;i <= list.length - 1;i ++)
{
list.data[i - 1] = list.data[i];
}
list.length --;
return SUCCESS;
}
}
return ERROR;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 51690 2014-10-30 17:32 数据库课程设计\数据结构实习报告.docx
文件 9699 2014-10-30 17:32 数据库课程设计\源程序.cpp
文件 287 2014-11-03 20:18 数据库课程设计\题目要求.txt
目录 0 2014-11-03 20:14 数据库课程设计
----------- --------- ---------- ----- ----
61676 4
相关资源
- C语言课程设计
- 我的C语言寒假作业-学生通讯录系统(
- C++通讯录管理系统源码(控制台)
- C语言通讯录管理系统彩色界面
- c++通讯录管理系统
- MFC个人通讯录管理系统
- 通讯录设计基于MFC的个人通讯录管理
- 基于MFC的个人通讯录管理系统
- VC++6.0+sql server,学院通讯录管理系统
- 数据结构实验报告~通讯录管理系统
- 学生通讯录管理系统 C语言课程设计
- 通讯录管理系统C++
- C语言学生通讯录管理系统
- 班级通讯录管理系统C语言课程设计
- 通讯录管理系统含源代码
- C语言 个人通讯录管理系统
- C++版通讯录管理系统的设计与实现
- c语言课程设计通讯录管理系统设计报
- 通讯录C++课程设计学生通讯录管理系
- 通讯录管理系统 源代码.rar
- 学生通讯录管理系统
- 通讯录管理系统(C语言)
- 数据结构 课程设计 通讯录管理系统
- c语言通讯录管理系统源码.zip
- C++个人通讯录管理系统
- C++个人通讯录管理系统
- 通讯录管理系统
- 第二阶段-通讯录管理系统C++完整工程
- 个人通讯录管理系统C语言课程设计报
- 用链表实现一个简单的通讯录管理系
评论
共有 条评论