commit 4be812650425619c4e54dd16f751366b28d0d4fe Author: p60783491 <1171404733@qq.com> Date: Fri Jan 11 11:37:44 2019 +0800 first commit diff --git a/通讯录.txt b/通讯录.txt new file mode 100644 index 0000000..2f30cbc --- /dev/null +++ b/通讯录.txt @@ -0,0 +1,25 @@ + ɽʡ 13598637452 15974376007 1149687745@qq.com + ʡ 15119876357 13875696008 2352147968@qq.com + ʡ 15274638596 14785236958 968574135@qq.com +Ǯ ɽʡ 16452489635 11856325495 875412052@qq.com + ʡ 13598635214 16985742366 698541278@qq.com + ʡ 13896357425 15803695742 365874669@qq.com + ɽʡ 13654785965 13965874125 432658896@qq.com + ʡ 15424789635 15874369524 986523147@qq.com + ʡ 13985745215 15963255587 1169857421@qq.com +Ժ ʡ 13874569325 15478963359 1965874325@qq.com +ſ ʡ 13698547258 15124785693 2547962569@qq.com +̷ ʡ 13562478965 14765985985 3658741223@qq.com + ʡ 15897542136 13985745213 569874662@qq.com + ʡ 13985475223 16584752139 2654789625@qq.com + ʡ 13952487694 18715479654 2416985475@qq.com + 㶫ʡ 13589653214 13695745825 2369548554@qq.com +ά Ϻ 18756395248 19658742368 1479856325@qq.com + 13875423698 15836985745 1756896524@qq.com + ʡ 18574569852 14698521478 1478569529@qq.com +ǿ ʡ 18745695221 13652478965 968521475@qq.com +Ҧ ӱʡ 19714625845 16574998556 874562116@qq.com + ʡ 15807372448 13574764112 1171987546@qq.com + ʡ 18545213696 16321457895 2352319609@qq.com + ʡ 15966639998 5555555555 11558962@qq.com + diff --git a/通讯录程序设计.c b/通讯录程序设计.c new file mode 100644 index 0000000..ad97401 --- /dev/null +++ b/通讯录程序设计.c @@ -0,0 +1,221 @@ +#include +#include +#include//׼⺯ +struct stu{//ݽṹ + char n[15];// + char d[15];// + char y[15],g[15];//绰1͵绰2 + char e[20]; // +}; +struct stu s[100];//ṹ飬 +FILE *fp;//ļָ +int N;//ͱѡ +void luru();//¼Ϣ +void xiuzheng();//Ϊûϵ˵ϢûǷҪ޸ +void xiugai();//޸Ϣ +void shuchu();//Ϣ +void baocun(int t);//Ϣ +void chazhao();//Ϣ +void wel();//˵ +void main() +{ + do{ system("cls");// + wel(); + scanf("%d",&N); + if(N==0) + break; + switch(N) + { + case 1:luru(); break; + case 2:shuchu(); break; + case 3:chazhao(); break; + case 4:xiuzheng(); break; + default:printf("!\n"); + } + }while(1);//do-whileʵֳķ +} +void wel() +{ + printf(" "); + printf(" ӭʹͨѶ¼ϵͳ\n\n\n"); + printf(" "); + printf(" *¼Ϣ밴1\n\n"); + printf(" "); + printf(" *Ϣ밴2\n\n"); + printf(" "); + printf(" *ѯϢ밴3\n\n"); + printf(" "); + printf(" *޸Ϣ밴4\n\n"); + printf(" "); + printf(" *ֹ밴0\n\n"); +} +void luru()//ʵ¼Ϣ +{ + int i=0,v,t;//iΪṹijʼַvΪжѭǷtΪ溯 + do{ system("cls");// + fflush(stdin);//ڴ滺 + printf("%dϵ˵\n",i+1); + gets(s[i].n); + fflush(stdin); + printf("%dϵ˵ļ\n",i+1); + gets(s[i].d); + fflush(stdin); + printf("%dϵ˵ĵ绰1\n",i+1); + scanf("%s",&s[i].y); + fflush(stdin); + printf("%dϵ˵ĵ绰2\n",i+1); + scanf("%s",&s[i].g); + fflush(stdin); + printf("%dϵ˵\n",i+1); + gets(s[i].e); + fflush(stdin); + i=i+1;//Ϊһѭ׼ + t=i; + system("cls");// + printf("밴1,ֹͣ밴0\n"); + scanf("%d",&v); + }while(v==1); + baocun(t); + printf("¼\n"); + system("pause");//ִͣ +} +void shuchu()//Ϣ +{ + int i,n;//iΪṹĵַ + system("cls"); + printf("\t\t绰1\t\t绰2\t\t\n"); + if((fp=fopen("ͨѶ¼.txt","r"))==NULL)//ļ + { + printf("File open error!\n"); + exit(0); + } + for(i=0;feof(fp)==0;i++) + { + fscanf(fp,"%s%s%s%s%s",s[i].n,s[i].d,&s[i].y,&s[i].g,s[i].e);//ļ + } + fclose(fp);//رļ + for(n=0;n<=i;n++) + printf("%s\t%s\t%s\t\t%s\t\t%s\n",s[n].n,s[n].d,s[n].y,s[n].g,s[n].e);//ļ + system("pause"); +} +void xiugai(int n)//޸ +{ int b,k;//bΪѡ޸ĶӦϢıkΪж޸Ƿı +do{ + system("cls"); + printf("ѡҪ޸ĵ\n"); + printf("1: 2:ַ 3:绰1 4:绰2 5.\n"); + scanf("%d",&b); + switch(b) + { + case 1: printf("Ҫ޸ĵ\n");scanf("%s",s[n].n); break; + case 2: printf("Ҫ޸ĵ\n");scanf("%s",s[n].d); break; + case 3: printf("Ҫ޸ĵ\n");scanf("%s",s[n].y); break; + case 4: printf("Ҫ޸ĵ\n");scanf("%s",s[n].g); break; + case 5: printf("Ҫ޸ĵ\n");scanf("%s",s[n].e); break; + default:printf("!\n"); + } + printf("޸ijɹ\n"); + printf("޸밴1 ˳޸밴0\n"); + scanf("%d",&k); + if(k==0) + break; +}while(1);//Զݽ޸ +} +void xiuzheng()//ҵϵ˵ĵַ޸ +{ int i,n=0,k=0,t; +char c[20]; +printf("Ҫ޸Ϣϵ˵\n"); +scanf("%s",c); +if((fp=fopen("ͨѶ¼.txt","r+"))==NULL)//ļжд +{ + printf("File open error!\n"); + exit(0); +} +for(i=0;feof(fp)==0;i++) +{ + fscanf(fp,"%s %s %s %s %s\n",s[i].n,s[i].d,s[i].y,s[i].g,s[i].e); + if(strcmp(c,s[i].n)==0) + { + n=i; + k++; + } +} +if(k==i) +{ + printf("޸ϵ\n"); +} +printf("ȷϵ\n"); +printf("\tַ\t绰1\t绰2\t\t\n"); +printf("%s\t%s\t%s\t%s\t\t%s\n",s[n].n,s[n].d,s[n].y,s[n].g,s[n].e);//ûϵ˵Ϣ +printf("ȷ޸밴1 ˳޸밴2\n"); +scanf("%d",&t); +if(t==1) + xiugai(n); +if(fclose(fp))//޸Ϣ˳ +{ + printf("رʧ\n"); + exit(0); +} +if((fp=fopen("ͨѶ¼.txt","w"))==NULL) +{ + printf("File open error!\n"); + exit(0); +} +for(n=0;n