• 大小: 515KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-09
  • 语言: 其他
  • 标签: C++  数据结构  

资源简介

今天刚完成的课程设计,好累呀!小型数据库管理(模拟)系统:通讯录系统 //或者:人员(学生)管理系统要求建立一个简洁完备的通讯录,内容可以保存在内存中也可以保存在磁盘中(但要维持数据的一致性)。要求能够实现(插入,删除,搜索,排序,外部存储:保证数据动态维护与一致性)等功能。①(1) 选用线性表(静态表/动态表 Array or linked list : 单向链表/双向链表/双向循环链表)②(2) 非线性结构实现: 二叉搜索树(Binary Search Tree)③(3) 非线性结构实现: AVL树④(4) 非线性结构实现: 哈希表(散列)Hashtable

资源截图

代码片段和文件信息

#include “b.h“
#include 
#include 
#include 
//#include 
//#include 
void stulist::MakeEmpty()
{
student *p1;//定义一个指针,指向student。
while (head->next!=NULL) 
{
p1=head->next;//
head->next=p1->next;
delete p1;
}
p1=head;
count=0;
}
void stulist::add(char *valuechar *saluechar *adlint chinint maint eng)//将新学生value插入到最后
{
student *newstu;
newstu=new student(valuesalueadlchinmaeng);
while(p->next!=NULL)
p=p->next;//经过while循环之后,p指向链尾
/*************
newstu->next=p->next;
// p=p->next=newstu;
p->next=newstu;p=p->next;
/*********************/
p->next=newstu;
newstu->number=count+1;
count++;
cout<}
/*********在学号no的学生之前插入一个新学生*******************/
void stulist::insert(int nochar *valuechar *saluechar *adlint chinint maint eng)
{
student *newstu;
student *node=head;
newstu=new student(valuesalueadlchinmaengno);
while (node->next!=NULL) {
if(node->number==no-1)
break;
node=node->next;
}
/************************
newstu->next=node->next;
newstu->number=no;
node=newstu;
newstu->next=node->next;
/*********************************/
newstu->next=node->next;
newstu->number=no;
node=node->next=newstu;//
/*************************/
student *p=node->next;
while (p!=NULL) 
{
p->number++;
p=p->next;
}
count++;
cout<}
void stulist::remove(int no)//删除元素value后面的学生学号依次加1
{
      student *p1*q;
      q=head->next;
      while(q!=NULL)
      {
          if(q->number==no)break;
          q=q->next;
      }
      if(q==NULL)
      {
          cout<<“没找到学号为“<          return;
      }
      p1=head;
      while(p1!=NULL)//找到q的前一个节点p
      {
          if(p1->next==q)break;
          p1=p1->next;
      }
      p1->next=q->next;
      delete q;
      count--;
    
      p1=p1->next;
      while(p1!=NULL)
      {
          p1->number--;
          p1=p1->next;
      }
//   print_name(no);
      cout<<“学号为“<}
void stulist::print()//输出链表
{
      student *p2;
  int average=0;
      if(head->next==NULL)//链表为空
      {
          cout<<“没有任何信息“<          return;
      }
      cout<<“学号“<      p2=head->next;
//   average=((p2->chinese+p2->english+p2->math)/3);//平均分
      while(p2->next!=NULL)
      {
  average=((p2->chinese+p2->english+p2->math)/3);//平均分
          cout<number<name<sex<add;
  cout<chinese<math<english<          p2=p2->next;
      }
  average=((p2->chinese+p2->english+p2->math)/3);
    cout<number<name<sex<add;
  cout<chinese

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        827  2008-01-17 01:08  student\a.h

     文件       7090  2008-01-17 12:39  student\b.cpp

     文件       1058  2008-01-17 03:30  student\b.h

     文件      33625  2008-01-17 12:39  student\Debug\b.obj

     文件      22521  2008-01-17 13:29  student\Debug\main.obj

     文件     233524  2008-01-17 13:29  student\Debug\student.exe

     文件     285592  2008-01-17 13:29  student\Debug\student.ilk

     文件      43520  2008-01-17 10:11  student\Debug\student.opt

     文件    1315304  2008-01-17 13:29  student\Debug\student.pch

     文件     607232  2008-01-17 13:29  student\Debug\student.pdb

     文件      99328  2008-01-17 15:00  student\Debug\vc60.idb

     文件     102400  2008-01-17 13:29  student\Debug\vc60.pdb

     文件          0  2008-01-16 16:15  student\f1.dat

     文件       3840  2008-01-17 13:29  student\main.cpp

     文件        560  2008-01-17 01:07  student\Menu.h

     文件        164  2008-01-17 12:46  student\s1.txt

     文件       4522  2008-01-15 22:59  student\student.dsp

     文件        539  2008-01-15 22:59  student\student.dsw

     文件      66560  2008-01-17 15:03  student\student.ncb

     文件      49664  2008-01-17 15:03  student\student.opt

     文件        248  2008-01-17 15:00  student\student.plg

     文件        173  2008-01-17 11:18  student\students.txt

     文件      96256  2008-01-17 15:08  student\雷湘强大型试验报告.doc

     目录          0  2008-01-17 13:29  student\Debug

     目录          0  2008-01-17 15:11  student

----------- ---------  ---------- -----  ----

              2974547                    25


评论

共有 条评论