日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

通讯录管理系统 指针 链表 学生管理系统 人员管理系统

發布時間:2023/12/31 windows 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 通讯录管理系统 指针 链表 学生管理系统 人员管理系统 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

下面只是一個通訊錄管理系統,不過增刪改查功能都是齊全的,這個只是當做一個模板使用,可以在這個上面作出修改,改成別的什么什么系統,僅做參考
密碼:123456

#include<stdio.h> #include<stdlib.h> #include<string.h> #include<conio.h> #define LEN sizeof(struct xinxi) struct xinxi {char xingming[30];char chengshi[10];char dianhau[15];char youbian[10];struct xinxi *next; }; struct xinxi *chuangjian() {int n=0; struct xinxi *head,*p1,*p2;char a[99]="123";while(strcmp(a,"0")){if(n==0){p1=(struct xinxi *)malloc(LEN);head=p1;}else{p2->next=p1;}printf("請輸入姓名:"); scanf("%s",&p1->xingming);printf("請輸入城市:");scanf("%s",&p1->chengshi);printf("請輸入電話:");scanf("%s",&p1->dianhau);printf("請輸入郵政編碼:");scanf("%s",&p1->youbian);p2=p1;p1=(struct xinxi *)malloc(LEN);n++;printf("是否要繼續輸入?繼續請輸入非零的數據,結束請輸入0\n"); scanf("%s",a);}printf("*******************************************\n");printf("結束輸入\n結束時別忘了保存到文件喲!!!\n");p2->next=NULL;return head;} void chazhao(struct xinxi *p2) {if(p2==NULL){printf("無數據 請創建或導入后查詢\n");}else{printf("按名字查找請輸入1,按城市查找請輸入2,按郵政編碼查找請輸入3\n\n");char ch[30];scanf("%s",ch);if(strcmp(ch,"1")==0){struct xinxi *a;a=p2;//保留頭指針 printf("請輸入你要查找的姓名:");char xingming1[30];scanf("%s",xingming1);while(1){ if(strcmp(p2->xingming,xingming1)==0){ printf("姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("**********************\n");break;} else if(p2->next==NULL){printf("查無此人,是否重新輸入?是 請輸入不為0的數據 否 請輸入0\n");char ch[30];scanf("%s",ch);if(strcmp(ch,"0")!=0){chazhao(a);} else{break;}break;//跳出后來調用的chazhao(a)的while循環 } else { p2=p2->next; }} }else if(strcmp(ch,"2")==0){char chengshi[30];printf("輸入你想查找的城市");scanf("%s",chengshi);while(p2!=NULL){if(strcmp(p2->chengshi,chengshi)==0){printf("姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("**********************\n");p2=p2->next; }else{p2=p2->next;}}}else if(strcmp(ch,"3")==0){char youbian[30];printf("輸入你想查找的郵政編碼");scanf("%s",youbian);while(p2!=NULL){if(strcmp(p2->youbian,youbian)==0){printf("姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("**********************\n");p2=p2->next;}else{p2=p2->next;}}}else{printf("輸入錯誤"); }} } void zengjia(struct xinxi *p3) {if(p3==NULL){printf("請創建或導入后再增加\n");}else{struct xinxi *p;while(p3->next!=NULL){p3=p3->next;}char ch[30];while(strcmp(ch,"0")!=0){p=(struct xinxi *)malloc(sizeof(struct xinxi));printf("請輸入姓名:"); scanf("%s",&p->xingming);printf("請輸入城市:");scanf("%s",&p->chengshi);printf("請輸入電話:");scanf("%s",&p->dianhau);printf("請輸入郵政編碼:");scanf("%s",&p->youbian);p3->next=p;p3=p;printf("是否繼續增加 是請輸入不為0的數據 否請輸入0\n");scanf("%s",ch);}printf("結束時別忘了保存到文件中喲!!!\n"); p3->next=NULL;} } struct xinxi *shanchu(struct xinxi *p2) {if(p2==NULL){printf("無數據 請創建或導入后再選擇刪除\n");}else{struct xinxi *a,*p;p=(struct xinxi *)malloc(sizeof(struct xinxi));a=p2;//保留頭指針 printf("請輸入你要刪除的姓名:");char xingming1[30];scanf("%s",xingming1);if(strcmp(p2->xingming,xingming1)==0){printf("刪除成功\n");return p2->next;free(p2);}else{while(1){if(p2->next==NULL){printf("查無此人,是否重新選擇刪除?是 請輸入不為0的數據 否 請輸入0\n");char ch[30];scanf("%s",ch);if(strcmp(ch,"0")!=0){shanchu(a);} else{break;}break;//跳出后來調用的chazhao(a)的while循環}else if(strcmp(p2->next->xingming,xingming1)==0){ p=p2;free(p2->next);p->next=p->next->next;printf("刪除成功\n");return a;break;} else { p2=p2->next;}}}} } void xiugai(struct xinxi *p2) {if(p2==NULL){printf("無數據 請創建或導入后修改\n");}else{struct xinxi *a;a=p2;//保留頭指針 printf("請輸入你要修改的姓名:");char xingming1[30];scanf("%s",xingming1);char n[30],m[30];while(1){ if(strcmp(p2->xingming,xingming1)==0){ while(strcmp(m,"0")!=0){printf("姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("\n");printf("修改姓名輸入1\n修改城市輸入2\n修改電話輸入3\n修改郵政編碼輸入4\n");scanf("%s",n);if(strcmp(n,"1")==0){printf("輸入新的名字:"); scanf("%s",&p2->xingming);printf("\n");printf("姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("\n");printf("是否繼續修改?是請輸入不為0的數據,否請輸入0\n");scanf("%s",m);break;}else if(strcmp(n,"2")==0){printf("輸入新的城市:"); scanf("%s",&p2->chengshi);printf("\n");printf("新的數據是:\n姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("\n");printf("是否繼續修改?是請輸入不為0的數據,否請輸入0\n");scanf("%s",m);break;}else if(strcmp(n,"3")==0){printf("輸入新的電話:"); scanf("%s",&p2->dianhau);printf("\n");printf("新的數據是:\n姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("\n");printf("是否繼續修改?是請輸入不為0的數據,否請輸入0\n");scanf("%s",m);break;}else if(strcmp(n,"4")==0){printf("輸入新的郵政編碼:"); scanf("%s",&p2->youbian);printf("\n");printf("新的數據是:\n姓名是:%s\n城市是:%s\n電話是:%s\n郵政編碼是:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("\n");printf("是否繼續修改?是請輸入不為0的數據,否請輸入0\n");scanf("%d",m);break;}else{printf("請重新輸入\n"); break;}}break;} else if(p2->next==NULL){printf("查無此人,是否重新輸入?是 請輸入不為0的數據 否 請輸入0\n");char ch[30];scanf("%s",ch);if(strcmp(ch,"0")!=0){chazhao(a);} else{break;}break;//跳出后來調用的chazhao(a)的while循環 } else { p2=p2->next;}}} } void paixu(struct xinxi *p2) {if(p2==NULL){printf("無數據 請創建或者導入后輸出\n"); }else{struct xinxi *p,*p1,*p3;p1=(struct xinxi*)malloc(sizeof(struct xinxi));for(p3=p2;p3!=NULL;p3=p3->next){for(p=p2;p->next!=NULL;p=p->next){if(strcmp(p->dianhau,p->next->dianhau)>0){strcpy(p1->xingming,p->xingming);strcpy(p->xingming,p->next->xingming);strcpy(p->next->xingming,p1->xingming);strcpy(p1->dianhau,p->dianhau);strcpy(p->dianhau,p->next->dianhau);strcpy(p->next->dianhau,p1->dianhau);strcpy(p1->chengshi,p->chengshi);strcpy(p->chengshi,p->next->chengshi);strcpy(p->next->chengshi,p1->chengshi);strcpy(p1->youbian,p->youbian);strcpy(p->youbian,p->next->youbian);strcpy(p->next->youbian,p1->youbian);}}}}while(p2!=NULL){printf("%s的信息如下:\n城市:%s\n電話:%s\n郵政編碼:%s\n",p2->xingming,p2->chengshi,p2->dianhau,p2->youbian);printf("**********************\n");p2=p2->next;} } struct xinxi *daoru() {struct xinxi *p2,*p1,*head,*p,*p3;int i=0;FILE *fp;if((fp=fopen("D:\\通訊錄.txt","rb"))==NULL){printf("無法打開文件\n");exit(0);}p3=(struct xinxi *)malloc(sizeof (struct xinxi));if(fscanf(fp,"%s\t%s\t%s\t%s\n",p3->xingming,p3->chengshi,p3->dianhau,p3->youbian)!=EOF&&fscanf(fp,"%s\t%s\t%s\t%s\n",p3->xingming,p3->chengshi,p3->dianhau,p3->youbian)==EOF){printf("無數據 請創建后導入");fclose(fp);}else{p2=p1=(struct xinxi *)malloc(sizeof (struct xinxi));head=NULL;strcpy(p1->xingming,p3->xingming);strcpy(p1->chengshi,p3->chengshi);strcpy(p1->dianhau,p3->dianhau);strcpy(p1->youbian,p3->youbian);head=p1;do{p1=(struct xinxi *)malloc(sizeof (struct xinxi));p=p2;p2->next=p1;p2=p1;}while(fscanf(fp,"%s\t%s\t%s\t%s\n",p1->xingming,p1->chengshi,p1->dianhau,p1->youbian)!=EOF); // p3=head; // head=head->next; // free(p3);free(p1);p->next=NULL;fclose(fp);printf("導入成功\n");return head;} } void baocun(struct xinxi *p2) {FILE *fp;if(!(fp=fopen("D:\\通訊錄.txt","wt+"))){printf("不能打開文件\n"); exit(0);}fputs("姓名\t城市\t電話\t郵政編碼\n",fp);while(p2!=NULL){fputs(p2->xingming,fp);fputs("\t",fp);fputs(p2->chengshi,fp);fputs("\t",fp);fputs(p2->dianhau,fp);fputs("\t",fp);fputs(p2->youbian,fp);fputs("\n",fp);p2=p2->next;}fclose(fp);printf("保存成功!"); } int main() {printf("請輸入密碼,共三次機會\n"); int i=1;char mima[30];char ch[30];struct xinxi *p=NULL;for(i=1;i<=3;i++){scanf("%s",mima);if(strcmp(mima,"123456")==0){ printf("輸入正確!\n");printf("***********************\n");system("cls");printf("\t\t歡迎來到通訊錄!\t\t\n");break;}else{printf("輸入錯誤 已錯誤%d次\n",i);if(i==3){printf("錯誤3次 系統退出");exit(0);}}}while(1){printf("\t\t\n請輸入選擇的功能:\n");printf("\t\t創建請輸入1(覆蓋原有文件創建新的通訊錄請謹慎選擇)\n");printf("\t\t導入請輸入2(把原有文件數據導入到程序中并對其進行操作)\n");printf("\t\t保存請輸入3(要想保存對文件的操作 請操作完成后進行保存)\n");printf("\t\t查找請輸入4\n");printf("\t\t增加請輸入5\n");printf("\t\t刪除請輸入6\n");printf("\t\t修改請輸入7\n");printf("\t\t排序并輸出請輸入8\n");printf("\t\t退出請輸入9\n"); printf("**********************\n");scanf("%s",ch);if(strcmp(ch,"1")==0){p=chuangjian();printf("**********************\n");}else if(strcmp(ch,"4")==0) {chazhao(p);printf("**********************\n");}else if(strcmp(ch,"5")==0){zengjia(p);printf("**********************\n");}else if(strcmp(ch,"6")==0){p=shanchu(p);printf("**********************\n");}else if(strcmp(ch,"7")==0){xiugai(p);printf("**********************\n");}else if(strcmp(ch,"8")==0){paixu(p);printf("**********************\n");}else if(strcmp(ch,"2")==0){p=daoru();}else if(strcmp(ch,"3")==0){baocun(p);}else if(strcmp(ch,"9")==0){exit(0);}else{printf("輸入錯誤,請重新輸入");}} }

總結

以上是生活随笔為你收集整理的通讯录管理系统 指针 链表 学生管理系统 人员管理系统的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。