通迅录Word格式文档下载.docx
《通迅录Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《通迅录Word格式文档下载.docx(25页珍藏版)》请在冰点文库上搜索。
![通迅录Word格式文档下载.docx](https://file1.bingdoc.com/fileroot1/2023-5/5/6345cdcc-4ca8-4fb7-bc94-1b0aa857ba77/6345cdcc-4ca8-4fb7-bc94-1b0aa857ba771.gif)
voidpaixu4();
voidpaixu5();
voidxiugai();
voidxianshi(intcount);
voidcuowu();
structfriends_listfriends[50];
intmain(void)
system("
colorf9"
);
charmi[10]="
qin123"
;
charm[10];
charna[10];
inti=0;
printf("
\t\t\t请输入您的姓名:
\n\t\t\t"
gets(na);
for(i=0;
i<
3;
i++)
{
\t\t\t%s您好!
请输入密码:
na);
gets(m);
if(strcmp(m,mi)==0)
printf("
\t\t\t欢迎!
\n"
system("
pause"
cls"
break;
}
if(strcmp(m,mi)!
=0)
printf("
\t\t\t密码错误!
\n"
if(i>
=3)
\t\t\t结束\n"
exit(0);
intchoice;
do
color1d"
\t***********************【通讯录信息管理系统】**********************\t\n\n"
\t***********【【【制作人:
湖南工业大学通信103班--秦慧娟】】】*********\t\n\n"
\t******************************【菜单】******************************\t\n"
\t*****************************【1.新建】*****************************\t\n"
\t*****************************【2.查询】*****************************\t\n"
\t*****************************【3.删除】*****************************\t\n"
printf("
\t****************************【4.排序】*****************************\t\n"
\t****************************【5.修改】*****************************\t\n"
\t************************【6.显示所有联系人】************************\t\n"
\t***************************【0.安全退出】*****************************\t\n"
请选择功能:
1-4\n\t\t\t"
scanf("
%d"
&
choice);
switch(choice)
case1:
new_friend(friends);
break;
case2:
search_friend();
case3:
count=del(count);
break;
case4:
paixu();
case5:
xiugai();
case6:
xianshi(count);
case0:
default:
cuowu();
}while(choice!
=0);
\t\t\t%s:
谢谢您使用通讯录功能!
\n\t\t\t"
欢迎下次使用!
return0;
}
voidnew_friend(structfriends_listfriends[])/*新建联系人*/
color0c"
structfriends_listf;
if(count==50)
\t\t\t通讯录已满!
return;
\t\t\t请输入新联系人的姓名:
"
%s"
f.name);
\t\t\t请输入新联系人的年龄:
f.age);
\t\t\t请输入新联系人的联系方式:
f.telephone);
\t\t\t请输入新联系人的QQ:
f.QQ);
\t\t\t请输入新联系人的地址:
f.address);
friends[count]=f;
count++;
voidsearch_friend()/*查找联系人*/
{
color87"
if(count==0)
\t\t\t通讯录是空的!
system("
else
{
ints;
\t\t*************【【通讯录管理系统】】***************\n\n"
\t\t**********按姓名查找请选1:
**********\n"
\t\t**********按电话查找请选2:
\t\t**********按年龄查找请选3:
\t\t**********按QQ号查找请选4:
\t\t**********按地址查找请选5:
**********\n\t\t\t\t"
scanf("
s);
switch(s)
{
case1:
chazhao1();
/*按姓名对联系人排序*/
case2:
chazhao2();
case3:
chazhao3();
chazhao4();
case5:
chazhao5();
default:
cuowu();
}
}
voidchazhao1()/*按姓名查找联系人*/
color7A"
inti;
intflag=0;
\t\t\t请输入要查找的联系人姓名:
name);
count;
if(strcmp(name,friends[i].name)==0)
flag=1;
}
if(flag)
{
\n\t\t\t姓名:
%s\t"
friends[i].name);
\n\t\t\t年龄:
%d\t"
friends[i].age);
\n\t\t\t电话:
friends[i].telephone);
\n\t\t\tQQ:
friends[i].QQ);
\n\t\t\t地址:
friends[i].address);
else
\n\t\t\t无此联系人!
voidchazhao2()/*按电话查找联系人*/
color4F"
chartelephone[20];
\t\t\t请输入要查找的联系人的电话:
telephone);
if(strcmp(telephone,friends[i].telephone)==0)
break;
=count)
voidchazhao3()/*按联系人的年龄查找*/
color1F"
intage;
\t\t\t请输入要查找的联系人的年龄:
age);
if(age==friends[i].age)
voidchazhao4()/*按的QQ查找联系人*/
color3B"
chars[20];
\t\t\t请输入您要查找的联系人的QQ:
s);
if(strcmp(s,friends[i].QQ)==0)
\t\t\t姓名:
%s\n"
voidchazhao5()/*按地址查找联系人*/
color58"
\t\t\t请输入您要查找的联系人的地址:
if(strcmp(s,friends[i].address)==0)
\t\t\t年龄:
intdel(intcount)/*删除联系人*/
color4e"
inti=0,j;
\t\t\t对不起!
你的通讯录中还没有联系人\n"
\t\t\t请输入想删除联系人的姓名:
if(strcmp(friends[i].name,s)==0)
for(j=i;
j<
count-1;
j++)
strcpy(friends[j].name,friends[j+1].name);
friends[j].age=friends[j+1].age;
strcpy(friends[j].telephone,friends[j+1].telephone);
strcpy(friends[j].QQ,friends[j+1].QQ);
strcpy(friends[j].address,friends[j+1].address);
\t\t\t已经成功删除!
return(count-1);
\t\t\t通讯录中没有此人!
returncount;
voidpaixu()/*对联系人进行排序*/
ints;
\t\t**********按姓名排序请选1:
\t\t**********按年龄排序请选2:
\t\t**********按QQ号排序请选3:
\t\t**********按电话排序请选4:
\t\t**********按地址排序请选5:
switch(s)
paixu1();
paixu2();
paixu3();
paixu4();
paixu5();
cuowu();
voidpaixu1()
inti,m,n;
intj;
structfriends_listtemp;
\t\t\t通讯录是空的!
for(j=i+1;
if(strcmp(friends[i].name,friends[j].name)>
0)
temp=friends[i];
friends[i]=friends[j];
friends[j]=temp;
%d\n"
\t\t\t电话:
\t\t\tQQ号:
\t\t\t地址:
%s\n\n\n"
\t\t\t排序完成!
voidpaixu2()
intm;
intn;
for(j=0;
if(friends[i].age>
friends[j].age)
voidpaixu3()
inti,j;
intm,n;
{
if(strcmp(friends[i].QQ,friends[j].QQ)>
friends[j]=friends[i];