数据结构 通讯录的制作
运用数据结构的双向链表结合C语言基本知识编写一个通讯录管理系统。本系统应完成以下几方面的功能1输入信息——enter();2显示信息——display();3查找以姓名作...
运用数据结构的双向链表结合C语言基本知识编写一个通讯录管理系统。
本系统应完成以下几方面的功能
1输入信息——enter();
2显示信息——display();
3查找以姓名作为关键字——search();
4删除信息——delete();
5存盘——save();
6装入——load();
设计要求
1每条信息至少包含:姓名(NAME)街道(STREET)城市(CITY)邮编(EIP)国家(STATE)几项
2作为一个完整的系统,应具有有好的界面个较强的容错能力
3上机能正常运行。
好的追分~~~ 展开
本系统应完成以下几方面的功能
1输入信息——enter();
2显示信息——display();
3查找以姓名作为关键字——search();
4删除信息——delete();
5存盘——save();
6装入——load();
设计要求
1每条信息至少包含:姓名(NAME)街道(STREET)城市(CITY)邮编(EIP)国家(STATE)几项
2作为一个完整的系统,应具有有好的界面个较强的容错能力
3上机能正常运行。
好的追分~~~ 展开
4个回答
展开全部
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
struct contacks
{ char name[10];
char street[20];
char city[10];
int eip;
char state[10];
}con[50];
int k=0;
void enter();
void display();
void lookandchange();
void del();
void save();
void main()
{
int a;
do
{
printf("\n\n ******************************************************************\n");
printf(" *"); printf("\t\twelcome enter the contacks system"); printf("\t*");
printf("\n ******************************************************************\n");
printf(" *"); printf("\t 1.Access information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 2.display information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 3.lookandchange information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 4.Delete information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 5.Save the information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 6. exit "); printf("\t\t\t\t\t*\n");
printf(" ******************************************************************\n");
printf(" Enter you choice : ");
scanf("%d",&a);
switch(a)
{
case 1:printf("\n");enter();break;
case 2:printf("\n");display();break;
case 3:printf("\n");lookandchange();break;
case 4:printf("\n");del();break;
case 5:printf("\n");save();break;
case 6:printf("\n");exit(0);break;
default:printf("\nThe choice is between 1 to 6.\n");
}
}while(a!=0);
}
void enter()
{
char ch[20];
printf("\nenter student information:\n");
do
{ printf("\nname: ");
scanf("%s",con[k].name);
printf("street: ");
scanf("%s",con[k].street);
printf("\ncity: ");
scanf("%s",con[k].city);
printf("\neip: ");
scanf("%d",&con[k].eip);
printf("\nstate: ");
scanf("%s",con[k].state);
k++;
printf("\nif want continue input student information(y/n): ");
scanf("%s",ch);
}while(strcmp(ch,"y")==0||strcmp(ch,"Y")==0);
display();
}
void display()
{ int i;
printf(" the information is:\n");
for(i=0;i<k;i++)
{ printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\n"); }
}
void lookandchange()
{
int i;
char a[20],ch[10];
printf("\nenter you want look name:");
scanf("%s",a);
for(i=0;i<k;i++)
if(strcmp(con[i].name,a)==0) printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\nenter you want change name:");
scanf("%s",a);
for(i=0;i<k;i++)
{
if(strcmp(con[i].name,a)==0)
{ printf("\nyou sure want change student name(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nname:"); scanf("%s",con[i].name);}
printf("\nyou sure want change street(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstreet"); scanf("%s",con[i].street);}
printf("\nyou sure want change city(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\ncity"); scanf("%s",con[i].city);}
printf("\nyou sure want change eip(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\neip"); scanf("%d",&con[i].eip);}
printf("\nyou sure want change state(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstate"); scanf("%s",con[i].state);}
}
}
display();
}
void del()
{
int i,j;
char c[20];
printf("\nenter you want delete name :\n");
printf("name:");
scanf("%s",&c);
for(i=0;i<k;i++)
if(strcmp(c,con[i].name)==0) break;
for(j=i;j<=2;j++)
con[j]=con[j+1];
printf("\t\t\tyou had delete %s\n",c);
k--;
display();
}
void save()
{ FILE *fp; int i;
if((fp=fopen("xinxi.txt","w"))==NULL)
{ printf("cannot write the file.\n");
exit(0);}
for(i=0;strlen(con[i].name)!=0;i++)
fprintf(fp,"%s %s %s %d %s\n",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
fclose(fp);
}
在vc++中调试通过 有问题可以hi我
你的第六个load功能 既然有第一个enter了 第六个就没必要了
在第三个中你还可以修改信息
虽然没用到链表 但功能均可实现
#include<string.h>
#include<stdlib.h>
#include<conio.h>
struct contacks
{ char name[10];
char street[20];
char city[10];
int eip;
char state[10];
}con[50];
int k=0;
void enter();
void display();
void lookandchange();
void del();
void save();
void main()
{
int a;
do
{
printf("\n\n ******************************************************************\n");
printf(" *"); printf("\t\twelcome enter the contacks system"); printf("\t*");
printf("\n ******************************************************************\n");
printf(" *"); printf("\t 1.Access information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 2.display information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 3.lookandchange information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 4.Delete information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 5.Save the information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 6. exit "); printf("\t\t\t\t\t*\n");
printf(" ******************************************************************\n");
printf(" Enter you choice : ");
scanf("%d",&a);
switch(a)
{
case 1:printf("\n");enter();break;
case 2:printf("\n");display();break;
case 3:printf("\n");lookandchange();break;
case 4:printf("\n");del();break;
case 5:printf("\n");save();break;
case 6:printf("\n");exit(0);break;
default:printf("\nThe choice is between 1 to 6.\n");
}
}while(a!=0);
}
void enter()
{
char ch[20];
printf("\nenter student information:\n");
do
{ printf("\nname: ");
scanf("%s",con[k].name);
printf("street: ");
scanf("%s",con[k].street);
printf("\ncity: ");
scanf("%s",con[k].city);
printf("\neip: ");
scanf("%d",&con[k].eip);
printf("\nstate: ");
scanf("%s",con[k].state);
k++;
printf("\nif want continue input student information(y/n): ");
scanf("%s",ch);
}while(strcmp(ch,"y")==0||strcmp(ch,"Y")==0);
display();
}
void display()
{ int i;
printf(" the information is:\n");
for(i=0;i<k;i++)
{ printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\n"); }
}
void lookandchange()
{
int i;
char a[20],ch[10];
printf("\nenter you want look name:");
scanf("%s",a);
for(i=0;i<k;i++)
if(strcmp(con[i].name,a)==0) printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\nenter you want change name:");
scanf("%s",a);
for(i=0;i<k;i++)
{
if(strcmp(con[i].name,a)==0)
{ printf("\nyou sure want change student name(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nname:"); scanf("%s",con[i].name);}
printf("\nyou sure want change street(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstreet"); scanf("%s",con[i].street);}
printf("\nyou sure want change city(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\ncity"); scanf("%s",con[i].city);}
printf("\nyou sure want change eip(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\neip"); scanf("%d",&con[i].eip);}
printf("\nyou sure want change state(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstate"); scanf("%s",con[i].state);}
}
}
display();
}
void del()
{
int i,j;
char c[20];
printf("\nenter you want delete name :\n");
printf("name:");
scanf("%s",&c);
for(i=0;i<k;i++)
if(strcmp(c,con[i].name)==0) break;
for(j=i;j<=2;j++)
con[j]=con[j+1];
printf("\t\t\tyou had delete %s\n",c);
k--;
display();
}
void save()
{ FILE *fp; int i;
if((fp=fopen("xinxi.txt","w"))==NULL)
{ printf("cannot write the file.\n");
exit(0);}
for(i=0;strlen(con[i].name)!=0;i++)
fprintf(fp,"%s %s %s %d %s\n",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
fclose(fp);
}
在vc++中调试通过 有问题可以hi我
你的第六个load功能 既然有第一个enter了 第六个就没必要了
在第三个中你还可以修改信息
虽然没用到链表 但功能均可实现
景联文科技
2024-06-11 广告
2024-06-11 广告
杭州景联文科技有限公司是国内领先的AI训练数据采集标注公司之一。我们专注于为人工智能企业提供高质量、大规模的数据采集和标注服务。我们的服务涵盖图像、视频、语音、文本等多种数据类型,致力于帮助企业高效构建、训练和部署机器学习模型。我们拥有专业...
点击进入详情页
本回答由景联文科技提供
展开全部
表名:UserInfo
字段列表:
ID:自动编号字段(主键)
UserName;文本(10):用户姓名
UserSex:是/否:用户性别
UserBirth:日期:用户生日
UserJobAddress:文本(100):工作地址
UserHomeAddress:文本(100):家庭地址
UserTelMobil:文本(12):手机号
UserTelOffice:文本(12):办公室电话
UserTelHome:文本(12):家庭电话
UserGroup:文本(10):所在用户组(进行分类,便于管理)
UserEmail:文本(100):电子邮件地址
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
struct contacks
{ char name[10];
char street[20];
char city[10];
int eip;
char state[10];
}con[50];
int k=0;
void enter();
void display();
void lookandchange();
void del();
void save();
void main()
{
int a;
do
{
printf("\n\n ******************************************************************\n");
printf(" *"); printf("\t\twelcome enter the contacks system"); printf("\t*");
printf("\n ******************************************************************\n");
printf(" *"); printf("\t 1.Access information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 2.display information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 3.lookandchange information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 4.Delete information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 5.Save the information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 6. exit "); printf("\t\t\t\t\t*\n");
printf(" ******************************************************************\n");
printf(" Enter you choice : ");
scanf("%d",&a);
switch(a)
{
case 1:printf("\n");enter();break;
case 2:printf("\n");display();break;
case 3:printf("\n");lookandchange();break;
case 4:printf("\n");del();break;
case 5:printf("\n");save();break;
case 6:printf("\n");exit(0);break;
default:printf("\nThe choice is between 1 to 6.\n");
}
}while(a!=0);
}
void enter()
{
char ch[20];
printf("\nenter student information:\n");
do
{ printf("\nname: ");
scanf("%s",con[k].name);
printf("street: ");
scanf("%s",con[k].street);
printf("\ncity: ");
scanf("%s",con[k].city);
printf("\neip: ");
scanf("%d",&con[k].eip);
printf("\nstate: ");
scanf("%s",con[k].state);
k++;
printf("\nif want continue input student information(y/n): ");
scanf("%s",ch);
}while(strcmp(ch,"y")==0||strcmp(ch,"Y")==0);
display();
}
void display()
{ int i;
printf(" the information is:\n");
for(i=0;i<k;i++)
{ printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\n"); }
}
void lookandchange()
{
int i;
char a[20],ch[10];
printf("\nenter you want look name:");
scanf("%s",a);
for(i=0;i<k;i++)
if(strcmp(con[i].name,a)==0) printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\nenter you want change name:");
scanf("%s",a);
for(i=0;i<k;i++)
{
if(strcmp(con[i].name,a)==0)
{ printf("\nyou sure want change student name(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nname:"); scanf("%s",con[i].name);}
printf("\nyou sure want change street(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstreet"); scanf("%s",con[i].street);}
printf("\nyou sure want change city(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\ncity"); scanf("%s",con[i].city);}
printf("\nyou sure want change eip(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\neip"); scanf("%d",&con[i].eip);}
printf("\nyou sure want change state(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstate"); scanf("%s",con[i].state);}
}
}
display();
}
void del()
{
int i,j;
char c[20];
printf("\nenter you want delete name :\n");
printf("name:");
scanf("%s",&c);
for(i=0;i<k;i++)
if(strcmp(c,con[i].name)==0) break;
for(j=i;j<=2;j++)
con[j]=con[j+1];
printf("\t\t\tyou had delete %s\n",c);
k--;
display();
}
void save()
{ FILE *fp; int i;
if((fp=fopen("xinxi.txt","w"))==NULL)
{ printf("cannot write the file.\n");
exit(0);}
for(i=0;strlen(con[i].name)!=0;i++)
fprintf(fp,"%s %s %s %d %s\n",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
fclose(fp);
}
在vc++中调试通过 有问题可以hi我
你的第六个load功能 既然有第一个enter了 第六个就没必要了
在第三个中你还可以修改信息
虽然没用到链表 但功能均可实现
字段列表:
ID:自动编号字段(主键)
UserName;文本(10):用户姓名
UserSex:是/否:用户性别
UserBirth:日期:用户生日
UserJobAddress:文本(100):工作地址
UserHomeAddress:文本(100):家庭地址
UserTelMobil:文本(12):手机号
UserTelOffice:文本(12):办公室电话
UserTelHome:文本(12):家庭电话
UserGroup:文本(10):所在用户组(进行分类,便于管理)
UserEmail:文本(100):电子邮件地址
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<conio.h>
struct contacks
{ char name[10];
char street[20];
char city[10];
int eip;
char state[10];
}con[50];
int k=0;
void enter();
void display();
void lookandchange();
void del();
void save();
void main()
{
int a;
do
{
printf("\n\n ******************************************************************\n");
printf(" *"); printf("\t\twelcome enter the contacks system"); printf("\t*");
printf("\n ******************************************************************\n");
printf(" *"); printf("\t 1.Access information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 2.display information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 3.lookandchange information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 4.Delete information"); printf("\t\t\t\t\t*\n");
printf(" *"); printf("\t 5.Save the information"); printf("\t\t\t\t*\n");
printf(" *"); printf("\t 6. exit "); printf("\t\t\t\t\t*\n");
printf(" ******************************************************************\n");
printf(" Enter you choice : ");
scanf("%d",&a);
switch(a)
{
case 1:printf("\n");enter();break;
case 2:printf("\n");display();break;
case 3:printf("\n");lookandchange();break;
case 4:printf("\n");del();break;
case 5:printf("\n");save();break;
case 6:printf("\n");exit(0);break;
default:printf("\nThe choice is between 1 to 6.\n");
}
}while(a!=0);
}
void enter()
{
char ch[20];
printf("\nenter student information:\n");
do
{ printf("\nname: ");
scanf("%s",con[k].name);
printf("street: ");
scanf("%s",con[k].street);
printf("\ncity: ");
scanf("%s",con[k].city);
printf("\neip: ");
scanf("%d",&con[k].eip);
printf("\nstate: ");
scanf("%s",con[k].state);
k++;
printf("\nif want continue input student information(y/n): ");
scanf("%s",ch);
}while(strcmp(ch,"y")==0||strcmp(ch,"Y")==0);
display();
}
void display()
{ int i;
printf(" the information is:\n");
for(i=0;i<k;i++)
{ printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\n"); }
}
void lookandchange()
{
int i;
char a[20],ch[10];
printf("\nenter you want look name:");
scanf("%s",a);
for(i=0;i<k;i++)
if(strcmp(con[i].name,a)==0) printf("%10s %20s %10s %6d %10s ",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
printf("\nenter you want change name:");
scanf("%s",a);
for(i=0;i<k;i++)
{
if(strcmp(con[i].name,a)==0)
{ printf("\nyou sure want change student name(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nname:"); scanf("%s",con[i].name);}
printf("\nyou sure want change street(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstreet"); scanf("%s",con[i].street);}
printf("\nyou sure want change city(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\ncity"); scanf("%s",con[i].city);}
printf("\nyou sure want change eip(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\neip"); scanf("%d",&con[i].eip);}
printf("\nyou sure want change state(y/n): ");
scanf("%s",ch);
if(strcmp(ch,"y")==0||strcmp(ch,"Y")==0) { printf("\nstate"); scanf("%s",con[i].state);}
}
}
display();
}
void del()
{
int i,j;
char c[20];
printf("\nenter you want delete name :\n");
printf("name:");
scanf("%s",&c);
for(i=0;i<k;i++)
if(strcmp(c,con[i].name)==0) break;
for(j=i;j<=2;j++)
con[j]=con[j+1];
printf("\t\t\tyou had delete %s\n",c);
k--;
display();
}
void save()
{ FILE *fp; int i;
if((fp=fopen("xinxi.txt","w"))==NULL)
{ printf("cannot write the file.\n");
exit(0);}
for(i=0;strlen(con[i].name)!=0;i++)
fprintf(fp,"%s %s %s %d %s\n",con[i].name,con[i].street,con[i].city,con[i].eip,con[i].state);
fclose(fp);
}
在vc++中调试通过 有问题可以hi我
你的第六个load功能 既然有第一个enter了 第六个就没必要了
在第三个中你还可以修改信息
虽然没用到链表 但功能均可实现
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
应该是数据库结构吧?如果是,给你个示例
表名:UserInfo
字段列表:
ID:自动编号字段(主键)
UserName;文本(10):用户姓名
UserSex:是/否:用户性别
UserBirth:日期:用户生日
UserJobAddress:文本(100):工作地址
UserHomeAddress:文本(100):家庭地址
UserTelMobil:文本(12):手机号
UserTelOffice:文本(12):办公室电话
UserTelHome:文本(12):家庭电话
UserGroup:文本(10):所在用户组(进行分类,便于管理)
UserEmail:文本(100):电子邮件地址
.....
想更详细就自己根据需要增加吧
表名:UserInfo
字段列表:
ID:自动编号字段(主键)
UserName;文本(10):用户姓名
UserSex:是/否:用户性别
UserBirth:日期:用户生日
UserJobAddress:文本(100):工作地址
UserHomeAddress:文本(100):家庭地址
UserTelMobil:文本(12):手机号
UserTelOffice:文本(12):办公室电话
UserTelHome:文本(12):家庭电话
UserGroup:文本(10):所在用户组(进行分类,便于管理)
UserEmail:文本(100):电子邮件地址
.....
想更详细就自己根据需要增加吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
LS没用到链表,LZ发消息给你了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询