数据结构课程设计同学录

2019-03-10 18:33

《数据结构与算法设计》课程设计报告

题目:

学生姓名: 学 号: 班 级: 指导教师:

2012年 月 日

============第一个=============== #include

#include #include //同学结构体 struct node {

char name[10]; char age[3]; char phone[14]; char id[19];

char address[26]; char qq[12]; char emil[20]; char like[20]; char time[10]; node *next; };

node *head[5]; int tense; //比较大小

int cmp(int i,node *p,node *q) {

if(i==1)

return strcmp(p->name,q->name); else if(i==2)

return p->age-q->age; else if(i==3)

return strcmp(p->qq,q->qq); else

return strcmp(p->address,q->address); }

void insert(node *q,int t) {

node *p;

// cout<<\\\\\\ if(head[t]==NULL) {

\\

head[t]=q;

//cout<<\\\\\\\\ } else {

if(cmp(tense,head[t],q)>0) {

q->next=head[t]; head[t]=q;

// cout<<\

\\\\\\\ // cout<<\ } else {

node *s; p=head[t]; s=p;

while(p!=NULL&&cmp(tense,p,q)<0) {

s=p;

p=p->next; }

q->next=p; s->next=q;

//cout<<\\\\\\\\ } } }

void start() {

int t; node *p; ifstream in;

in.open(\ if(!in)

cout<<\打开文件有异常\ else {

char name[8]; in>>name;

while(strcmp(name,\ {

p=new node;

strcpy(p->name,name);

in>>p->age>>p->phone>>p->id>>p->address>>p->qq>>p->emil>>p->like>>p->time; p->next=NULL; // cout<name<<\\\\\\\\

if(strcmp(p->time,\小学\ t=1;

else if(strcmp(p->time,\中学\ t=2;

else if(strcmp(p->time,\高中\ t=3;

else if(strcmp(p->time,\大学\ t=4;

// cout<>name;

//cout<

in.close(); }

void print() {

for(int i=1;i<=4;i++) {

cout<<\ node *p; p=head[i];

while(p!=NULL) {

cout<name<<\\\\\\ p=p->next; } } }

void sort(int i) {

node *q;

while(head[i]!=NULL) {

q=head[i];

head[i]=head[i]->next; q->next=NULL; insert(q,0); }

head[i]=head[0]; head[0]=NULL; }

void search(char *s) {

node *p; int y=0;

for(int i=1;i<=4;i++)

\\


数据结构课程设计同学录.doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:2011一级建造师工程经济试题及答案解析

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: