欧美色欧美亚洲高清在线观看,国产特黄特色a级在线视频,国产一区视频一区欧美,亚洲成a 人在线观看中文

  1. <ul id="fwlom"></ul>

    <object id="fwlom"></object>

    <span id="fwlom"></span><dfn id="fwlom"></dfn>

      <object id="fwlom"></object>

      簡易水電費管理系統(tǒng)源程序代碼(合集五篇)

      時間:2019-05-14 07:30:20下載本文作者:會員上傳
      簡介:寫寫幫文庫小編為你整理了多篇相關(guān)的《簡易水電費管理系統(tǒng)源程序代碼》,但愿對你工作學(xué)習(xí)有幫助,當(dāng)然你在寫寫幫文庫還可以找到更多《簡易水電費管理系統(tǒng)源程序代碼》。

      第一篇:簡易水電費管理系統(tǒng)源程序代碼

      簡易水電費管理系統(tǒng)源程序代碼

      法一:

      #include #include #include struct member {char no[100];char name[20];char password[20];float wfee;float efee;}memb;void newadd(int n){ int t,i;fseek(fp,0,SEEK_END);printf(“>>新添人數(shù):”);scanf(“%d”,&t);for(i=0;i>輸入卡號:”);scanf(“%s”,a);int i=0;rewind(fp);while(1)

      { fread(&memb,sizeof(struct member),1,fp);if(feof(fp)||memb.no==a)break;i++;} if(!feof(fp)){ printf(“>>卡號:”);printf(“%sn”,memb.no);printf(“>>姓名:”);printf(“%sn”,memb.name“);printf(”>>水費:“);printf(”%fn“,memb.wfee);printf(”>>電費:“);printf(”%fn“,memb.efee);

      } else

      printf(”>>查無此人n“);};void delete(int n){ char c[100];printf(”>>刪除的卡號:“);scanf(”%s,“ c);if((fp1=fopen(”temp.bin“,”wb“))==NULL){

      printf(”>>不能建立臨時文件,無法刪除n“);} rewind(fp);while(1){ fread(&memb,sizeof(struct member),1,fp);if(feof(fp))break;if(memb.no!=c)fwrite(&memb,sizeof(struct member),1,fp1);} fclose(fp1);fclose(fp);remove(”member.bin“);rename(”temp.bin“,”member.bin“);fp=fopen(”member.bin“,”rb++“);};main(){ char a[100];char b[20];FILE *fp;printf(”歡迎進入水電費管理系統(tǒng)n“)int i=0,sel=1;if((fp=fopen(”member.bin“,”wb++“))==NULL){ printf(”>>不能建立member.bin文件n“);return(0);} while(sel!=0){ printf(”| 1 | 2 | 3 | 4 |n“);printf(”|-----------------------------|n“);printf(”|新添成員

      |查找個人信息

      |刪除成員

      |退出

      |n);fseek(fp,0,SEEK_END);scanf(“%d”,&sel);switch(sel){ case 1: newadd(sel);break;clscr();exit(0);case 2: printf(“請輸入您的卡號:”);

      printf(“%s”,a);printf(“請輸入您的密碼:”);puts(b);while(strcmp(a,memb.no)==0&&strcmp(b,memb.password)==0)look(sel);printf(“您的輸入有誤n”);break;clscr();exit(0);

      case 3: delete(sel);break;clscr();exit(0);}

      法二:

      #include #include #include #include #include struct member {char no[100];char name[20];char password[20];float wfee;float efee;}memb;void newadd(int n){ int t,i;FILE *fp;fp=fopen(“e:member.bin”,“a”);fseek(fp,0,SEEK_END);printf(“>>新添人數(shù):”);scanf(“%d”,&t);for(i=0;i

      if(fp==NULL)printf(“****”);printf(“>>輸入卡號:”);scanf(“%s”,a);i=0;rewind(fp);while(1)

      { fread(&memb,sizeof(struct member),1,fp);if(feof(fp)||strcmp(memb.no,a)==0)break;i++;} if(!feof(fp)){ printf(“>>卡號:”);printf(“%sn”,memb.no);printf(“>>姓名:”);printf(“%sn”,memb.name);printf(“>>水費:”);printf(“%fn”,memb.wfee);printf(“>>電費:”);printf(“%fn”,memb.efee);} else

      printf(“>>查無此人n”);getch();fclose(fp);} void dele(int n){ char c[100];FILE *fp,*fp1;fp=fopen(“e:member.bin”,“rb”);printf(“>>刪除的卡號:”);scanf(“%s” ,c);

      if((fp1=fopen(“temp.bin”,“wb”))==NULL){

      printf(“>>不能建立臨時文件,無法刪除n”);} rewind(fp);while(1){ fread(&memb,sizeof(struct member),1,fp);if(feof(fp))break;if(strcmp(memb.no,c)!=0)fwrite(&memb,sizeof(struct member),1,fp1);} fclose(fp1);fclose(fp);remove(“member.bin”);rename(“temp.bin”,“member.bin”);

      fp=fopen(“member.bin”,“rb+”);} main(){ char a[100];char b[20];int i=0,sel=1;FILE *fp;printf(“歡迎進入水電費管理系統(tǒng)n”);if((fp=fopen(“e:member.bin”,“wb”))==NULL){ printf(“>>不能建立member.bin文件n”);return(0);} while(sel!=0){ printf(“| 1 | 2 | 3 | 4 |n”);printf(“|-----------------------------|n”);printf(“|新添成員

      |查找個人信息

      |刪除成員

      |退出

      |n”);fseek(fp,0,SEEK_END);scanf(“%d”,&sel);printf(“sel=%dn”,sel);switch(sel){ case 1: newadd(sel);

      system(“cls”);break;case 2: look(sel);system(“cls”);break;

      case 3: dele(sel);system(“cls”);

      break;

      } } }

      第二篇:倉庫庫存管理系統(tǒng)源程序

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      倉庫庫存管理系統(tǒng)源程序

      #include #include #include #include int shoudsave=0;struct item//物品信息定義 { char code[10];//物品編碼

      char name[20];//物品名稱

      int num;

      //商品數(shù)量

      int level;//物品等級

      }item;typedef struct node { struct item data;struct node * next;}Node,*Link;//定義為鏈表 void menu()//頁面顯示函數(shù) {

      精心收集

      精心編輯

      精致閱讀 如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      system(“cls”);//清屏函數(shù)

      printf(“***********************************《物品庫存管理》*****************************n”);printf(“

      n”);

      printf(“n

      <1> 物品入庫管理ntn

      <2> 物品出庫管理n”);printf(“n

      <3> 瀏覽庫內(nèi)物品信息ntn

      <4> 修改物品信息n”);printf(“n

      <5> 保存物品信息ntn

      <0> 退出庫存管理n”);printf(“

      n”);cout<<“********************************************************************************”<

      void printstart(){ printf(“-----------n”);printf(“n

      請選擇操作:”);

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      } void Wrong()//錯誤處理函數(shù) { printf(“輸入錯誤!n”);getchar();getchar();menu();

      return;} void Nofind(){ printf(“沒有找到該物品!n”);} void printc()//本函數(shù)用于輸出中文 { printf(“ 物品編碼

      物品名稱

      物品數(shù)量

      n”);} void printe(Node *p)//輸出物品信息函數(shù) { cout<

      ”<

      data.code<<“

      ”<

      data.name<<“

      ”<

      data.num<<“

      精心收集

      精心編輯

      精致閱讀

      如需請下載!物品等級

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      ”<

      data.level;} Node *Locate(Link l,char findmess[],char nameorcode[])//用于定位連接中,符合要求的結(jié)點,并返回該指針 {

      Node *r;if(strcmp(nameorcode,“code”)==0)// {

      } else

      if(strcmp(nameorcode,“name”)==0)//按名稱查詢 {

      r=l->next;while(r!=NULL){ r=l->next;while(r!=NULL){

      } if(strcmp(r->data.code,findmess)==0)return r;r=r->next;

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      }

      }

      } if(strcmp(r->data.name,findmess)==0)return r;r=r->next;return 0;void Add(Link l)//增加物品函數(shù) {

      Node *p,*r,*s;char code[10];r=l;s=l->next;while(r->next!=NULL)r=r->next;while(l){

      system(“cls”);//清屏函數(shù)

      cout<<“請輸入商品編碼(輸入'0'返回上一級菜單):”<

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      while(s){

      if(strcmp(s->data.code,code)==0){ printf(“物品編碼為'%s'的物品已經(jīng)存在,如果要修改請選擇'4 修改'!n”,code);

      printstart();

      printc();

      printe(s);

      printstart();

      printf(“n”);

      return;

      }

      s=s->next;

      }

      p=(Node *)malloc(sizeof(Node));

      strcpy(p->data.code,code);

      printf(“請輸入物品名稱:”);

      scanf(“%s”,p->data.name);getchar();

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      printf(“請輸入物品數(shù)量:”);

      scanf(“%d”,&p->data.num);

      printf(“請輸入物品等級:”);

      scanf(“%d”,&p->data.level);

      p->next=NULL;

      r->next=p;

      r=p;

      shoudsave=1;} menu();} void Qur(Link l)//查詢物品信息函數(shù) { int sel;char findmess[20];Node *p;if(!l->next){

      printf(“n沒有信息可查詢!n”);

      getchar();

      getchar();menu();

      精心收集

      精心編輯

      精致閱讀 如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      return;

      } system(“cls”);//清屏函數(shù)

      printf(“n 1按物品編碼查詢n 2按物品名稱查詢n”);scanf(“%d”,&sel);if(sel==1)// { printf(“請輸入要查詢的編碼:n”);scanf(“%s”,findmess);p=Locate(l,findmess,“code”);if(p){

      printf(“tttt查詢結(jié)果n”);

      printstart();

      cout<

      printc();

      cout<

      printe(p);

      cout<

      printstart();

      getchar();getchar();

      精心收集

      精心編輯

      精致閱讀 如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      }

      } menu();return;else Nofind();else

      if(sel==2)// {

      printf(“請輸入要查找的物品名稱:”);scanf(“%s”,findmess);p=Locate(l,findmess,“name”);if(p){

      printf(“ttt查詢結(jié)果n”);

      printstart();cout<

      printc();cout<

      printe(p);cout<

      printstart();

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      getchar();

      getchar();

      menu();

      return;

      }

      else

      Nofind();

      }

      else Wrong();getchar();

      system(“cls”);//清屏函數(shù)

      menu();} void Del(Link l)//刪除 { int sel;Node *p,*r;char findmess[20];if(!l->next){ system(“cls”);//清屏函數(shù)

      精心收集

      精心編輯 精致閱讀 如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      } printf(“n您的倉庫為空!n”);getchar();getchar();menu();return;system(“cls”);//清屏函數(shù)

      printf(“n 1按物品編碼出倉n 2按物品名稱出倉n”);scanf(“%d”,&sel);if(sel==1){

      printf(“請輸入要出倉的物品編碼:”);scanf(“%s”,findmess);p=Locate(l,findmess,“code”);if(p){

      r=l;while(r->next!=p)r=r->next;r->next=p->next;free(p);printf(“n該物品已經(jīng)成功出倉n”);

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      }

      } shoudsave=1;getchar();getchar();menu();return;else Nofind();else

      if(sel==2){

      system(“cls”);//清屏函數(shù) printf(“請輸入要出倉的物品名:”);scanf(“%s”,findmess);p=Locate(l,findmess,“name”);if(p){

      r=l;while(r->next!=p)r=r->next;r->next=p->next;

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      }

      }

      } free(p);printf(“n該物品已經(jīng)成功出倉!n”);shoudsave=1;getchar();getchar();menu();return;else Nofind();else Wrong();void Modify(Link l)//物品信息修改 {

      Node *p;char findmess[20];if(!l->next){ system(“cls”);//清屏函數(shù)

      printf(“n您的庫存為空,無需修改!n”);

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      } getchar();getchar();menu();return;printf(“請輸入要修改的物品編碼:”);scanf(“%s”,findmess);p=Locate(l,findmess,“code”);if(p){

      system(“cls”);//清屏函數(shù)

      printf(“請輸入新編碼(原來的是%s):”,p->data.code);scanf(“%s”,p->data.code);printf(“請輸入新名稱(原來的是%s):”,p->data.name);scanf(“%s”,p->data.name);getchar();printf(“請輸入新的物品數(shù)量(原來的是%d):”,p->data.num);scanf(“%d”,&p->data.num);getchar();printf(“請輸入新的物品等級(原來的是%d):”,p->data.level);scanf(“%d”,&p->data.level);

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      getchar();

      printf(“n修改資料成功!n”);

      shoudsave=1;

      getchar();menu();

      return;} else Nofind();getchar();menu();} void Disp(Link l){ int count=0;Node *p;p=l->next;if(!p){

      printf(“n 沒有資料可以顯示!n”);

      getchar();getchar();

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      menu();

      return;} printf(“tttt顯示結(jié)果n”);printstart();printc();printf(“n”);while(p){

      printe(p);

      p=p->next;} printstart();printf(“n”);}

      void Save(Link l)//物品信息保存 { FILE *fp;Node *p;int flag=1,count=0;fp=fopen(“c:student”,“wb”);

      精心收集

      精心編輯 精致閱讀 如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      if(fp==NULL){ printf(“n重新打開文件時錯誤!n”);exit(1);} p=l->next;while(p){ if(fwrite(p,sizeof(Node),1,fp)==1){

      p=p->next;

      count++;} else {

      flag=0;

      break;} } if(flag){ system(“cls”);//清屏函數(shù)

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      printf(“n 文件保存成功.(有%d條記錄保存成功.)n”,count);

      shoudsave=0;

      getchar();

      getchar();

      menu();} fclose(fp);} void main()//主函數(shù) {

      menu();Link l;//鏈表

      Node *r;int sel;char ch;int count=0;l=(Node *)malloc(sizeof(Node));l->next=NULL;r=l;while(l){ scanf(“%d”,&sel);

      精心收集

      精心編輯

      精致閱讀 如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      if(sel==0){

      if(shoudsave==1){ getchar();printf(“n 資料已改動,是否將改動的文件保存到文件中(y or n)?n”);

      } switch(sel){ case 1:Add(l);break;//物品進庫 case 2:Del(l);break;//物品出庫 case 3:Qur(l);break;//查詢物品 case 4:Modify(l);break;//修改物品信息 case 5:Save(l);break;//保存物品信息

      } printf(“n 已退出系統(tǒng)!n”);break;scanf(“%c”,&ch);if(ch=='y' || ch=='Y')Save(l);

      精心收集

      精心編輯

      精致閱讀

      如需請下載!

      演講稿 工作總結(jié) 調(diào)研報告 講話稿 事跡材料 心得體會 策劃方案

      default:Wrong();getchar();break;}

      精心收集

      精心編輯 精致閱讀 如需請下載!

      } }

      第三篇:病房管理源程序

      附件:病房管理源程序

      #include #include #include #include #define ok 1 #define error 0 #define TURE 1 #define FALSE 0 #define max_name 21

      typedef struct bed{

      int

      number;

      /*床位號*/ int

      live;

      /*是否有人*/

      unsigned char name[max_name];

      /*人名最長長度*/ struct bed

      *next;

      /*下一個床鋪*/ }bed;

      typedef struct sickroom { int

      number;

      /*病房號*/ int

      bednum;

      /*房內(nèi)床位數(shù)*/ int

      livenum;

      /*已住人數(shù)*/ struct sickroom *next;

      /*指向下一個病房*/

      struct bed *firstbed;

      /*指向第一個床位*/ }sickroom;

      int roomnum(sickroom *q)/*返回醫(yī)院中的房間的個數(shù)*/ {

      int i;

      for(i=0;q!=NULL;i++)q=q->next;return i;}

      int Initialization(sickroom *H)/*初始化操作*/ {

      int i,n,k;sickroom *q,*sq;bed *p,*bp;printf(“----------------------請輸入病房個數(shù):”);scanf(“%d”,&n);getchar();

      int i,x,n,m,y;sickroom *q;bed *p;q=H->next;n=roomnum(q);

      printf(“請輸入您要入住的病房號(目前共有%d個病房):”,n);scanf(“%d”,&x);getchar();printf(“n”);while(x>n||x<1){

      printf(“您輸入的病房號錯誤,請重新輸入:”);

      scanf(“%d”,&x);

      getchar();

      printf(“n”);} for(i=1;inext;

      /*q指向選擇的病房*/ m=q->bednum-q->livenum;if(m==0){

      printf(“-------------------------此病房已滿。。(回車?yán)^續(xù))-----------n”);

      getchar();

      printf(“n”);

      return 0;} p=q->firstbed;printf(“空床鋪有:”);for(i=1;i<=q->bednum;i++){

      if(p->live==0)printf(“ %d號床鋪”,i);

      p=p->next;} printf(“n輸入您要選擇的床鋪號:”);scanf(“%d”,&y);getchar();p=q->firstbed;for(i=1;inext;

      /*指向所選床鋪*/ if(p->live==1){

      printf(“-------------------------輸入錯誤!(回車?yán)^續(xù))----------------------------n”);

      getchar();

      return 0;} p->live=1;

      {

      printf(“-------------------------查無此床(回車?yán)^續(xù))-----------n”);

      getchar();

      return 0;

      } } if(q->live==0){

      printf(“-------------------------此床鋪為空!(回車?yán)^續(xù))-------------n”);

      getchar();

      return 0;} q->live=0;p->livenum--;H->livenum--;printf(“-------------------------”);printf(“%s”,q->name);printf(“已成功出院!n”);printf(“------------------------(回車?yán)^續(xù))----------------n”);getchar();for(i=1;i<=21;i++)q->name[i-1]=0;return 1;}

      int searchsickroom(sickroom *H)/*查找出醫(yī)院內(nèi)病房空床位*/ {

      int i,m,z=0;

      sickroom *q;

      q=H->next;

      for(i=1;q;i++)

      {

      m=q->bednum-q->livenum;

      if(m>0)printf(“

      %d號病房有%d個床位n”,i,m);

      else printf(“

      %d號病房已滿n”,i);

      q=q->next;

      z+=m;

      }

      printf(“

      院中還剩%d個床位(回車?yán)^續(xù))。。n”,z);

      getchar();

      return 1;}

      int n=0,m=0;

      sickroom *q;

      bed *p;

      char a[max_name];

      printf(“n請輸入您要查找的人名(二十個字符以內(nèi),以空格結(jié)束):”);

      scanf(“%s”,a);

      getchar();

      for(q=H->next;q;q=q->next)

      {

      for(p=q->firstbed;p;p=p->next)

      {

      if(p->live==1)

      if(strcmp(a,p->name)==0)

      {

      n=q->number;

      m=p->number;

      }

      }

      }

      if(m==0&&n==0)

      {

      printf(“-------------------------查無此人(回車?yán)^續(xù))------------n”);

      getchar();

      }

      else

      {

      printf(“

      此人目前住在%d號房%d號床。。n”,n,m);

      printf(“---------------------(回車?yán)^續(xù))-----------------n”);

      getchar();

      }

      return 1;}

      int nowhospital(sickroom *H)/*顯示目前醫(yī)院的住院情況*/ {

      int i;

      sickroom *q;

      bed *p;

      i=0;

      for(q=H->next;q;q=q->next)

      {

      printf(“n病房%d —>t”,q->number);

      for(p=q->firstbed;p;p=p->next)

      if(i==2)searchbed(H);

      else

      if(i==3)

      searchpeople(H);

      else

      if(i==4)

      nowhospital(H);

      else

      if(i==0);

      else

      {

      printf(“輸入錯誤!(回車?yán)^續(xù))n”);

      getchar();

      }

      }while(i!=0);

      return ok;}

      void main()/*主程序*/ {

      int i;

      sickroom H;

      system(“CLS”);

      printf(“********12**************14************12************14********12*********12 n”);

      printf(“

      _______________________________________________________

      n”);

      printf(“

      n”);

      printf(“

      歡迎進入醫(yī)院管理程序!!

      n”);

      printf(“

      n”);

      printf(“

      請先對醫(yī)院進行初始化。。(回車鍵繼續(xù))

      n”);

      printf(“

      1_____________________________________________________ 2

      n”);

      getchar();

      Initialization(&H);

      printf(“n”);

      do

      {

      system(“CLS”);

      printf(“********12**************14************12************14********12******12********n”);

      printf(“

      _____________________________________

      n”);

      printf(“

      n”);

      printf(“

      選擇菜單:

      n”);

      printf(“

      [1] 入院操作

      n”);

      printf(“

      [2] 出院操作

      n”);

      printf(“

      [3] 查詢醫(yī)院信息

      n”);

      printf(“

      [0] 退出醫(yī)院

      n”);

      第四篇:源程序(醫(yī)院藥房藥品管理系統(tǒng)C++)

      源程序: # include //包含文件讀寫 # include # include //包含strcmp()字符是否相等 #include //包含system(“cls”)清屏

      #define MAX 60

      //下列字符數(shù)組的大小 struct Date{//日期

      char year[MAX];//年

      char month[MAX];//月

      char day[MAX];//日 };struct Goods{//藥品信息

      char name[MAX];//藥品名稱

      char price[MAX];//藥品價格

      char number[MAX];//藥品數(shù)量

      char cost[MAX];//藥品總價

      char kind[MAX];//藥品的種類

      Date indate;//入庫日期

      Date xiaoqi;//到期時間

      Goods * next;//下一個結(jié)點

      };

      class Cangkuguanli { //類定義與實現(xiàn) private:

      int length;//客戶數(shù)量

      Goods * head;//列表的頭結(jié)點

      Goods * current;//當(dāng)前結(jié)點 public:

      Cangkuguanli()//構(gòu)造函數(shù)

      {

      head=new Goods;//創(chuàng)建頭結(jié)點

      current=head;

      current->next=NULL;

      length=0;//長度為0

      }

      void Creatlist()//創(chuàng)建新的列表

      {

      char g='Y';

      int s=0;

      length=0;//初始長度為0;

      current=head;

      do {

      Goods * temp=new Goods;//構(gòu)建新結(jié)點信息

      length++;//每加一個結(jié)點 鏈表長度增1

      temp->next=NULL;

      cout<<“

      請輸入藥品名稱: ”;

      cin>>temp->name;

      cout<<“

      請輸入單價

      : ”;

      cin>>temp->price;

      cout<<“ 請輸入藥品數(shù)量:

      ”;

      cin>>temp->number;

      cout<<“

      請輸入總費用 : ”;

      cin>>temp->cost;

      cout<<“ 請輸入日期(**** ** **): ”;

      cin>>temp->indate.year>>temp->indate.month>>temp->indate.day;

      cout<<“ 請輸入藥品有效期(**** ** **):”;

      cin>>temp->xiaoqi.year>>temp->xiaoqi.month>>temp->xiaoqi.day;

      cout<<“ 請輸入藥品種類: ”;

      cin>>temp->kind;

      if(head==NULL){head=temp;current=temp;} //head頭指針,current尾指針

      else {current->next=temp,current=temp;}

      do{

      cout<<“ next ?(Y N)”;//是否繼續(xù)存入新產(chǎn)品

      cin>>g;

      if(g!='Y'&&g!='N')

      {

      cout<<“n error?。 ”;

      }

      }while(g!='Y'&&g!='N');

      }while(g=='Y');//判斷是否繼續(xù)插入新結(jié)點

      }

      void Open()//打開一個數(shù)據(jù)文件,并建立鏈表關(guān)聯(lián) 和文件中的記錄對應(yīng)

      {

      char fname[20];//文件名稱

      cout<<“ input the name of the file n”;

      cin>>fname;//輸入要打開的文件名

      ifstream infile(fname);//創(chuàng)建輸入文件流

      infile>>length;

      cout<<“n length is: ”<

      //if(length==0)cout<<“ 數(shù)據(jù)為空n”;

      for(int i=0;i

      {

      Goods * t=new Goods;

      t->next=NULL;

      infile>>t->name>>t->price>>t->number>>t->cost>>t->kind>>

      t->indate.year>>t->indate.month>>t->indate.day;

      if(head==NULL){head=t;current=t;}//跟上面的鏈表創(chuàng)建相似

      else {current->next=t,current=t;}

      }

      infile.close();//關(guān)閉文件流

      }//open

      void Save()//保存鏈表信息到文件 {

      if(length==0)

      {

      cout<<“ 列表為空 不需存盤 n”;

      return;

      }

      char fname[20];//文件名稱

      cout<<“ input the name of the file you want to put data in n”;

      cin>>fname;

      ofstream outfile(fname);//創(chuàng)建輸出文件流

      Goods * temp=head->next;

      outfile<

      while(temp!=NULL)//把所有結(jié)點寫入到文件fname

      {

      outfile<name<<“ ”<price<<“ ”<number<<“ ”<cost<<“ ”<kind

      << “ ”<indate.year<<“ ”<indate.month<<“ ”<indate.day<<“ ”<xiaoqi.year<<“ ”<xiaoqi.month<<“ ”<xiaoqi.day<

      //寫入每個結(jié)點信息

      temp=temp->next;

      }

      outfile.close();//關(guān)閉文件流 }

      void printinfor(Goods * current)//輸出一個結(jié)點的信息到字符界面 {

      if(current==NULL)

      { cout<<“n元素為空!!n ”;return;

      }

      cout.fill(' ');cout<name;

      cout.width(8);

      cout.width(8);cout<price;cout.width(8);

      cout<number;cout.width(8);cout<cost;//就是給current->cost10個字符輸出,不夠往前面加‘ ’空格

      cout.width(10);cout<kind;cout.width(10);cout<< current->indate.year<<“.”<indate.month<<“.”<indate.day;cout.width(10);cout<xiaoqi.year<<“.”<xiaoqi.month<<“.”<xiaoqi.day;cout<

      void Show()//輸出所有結(jié)點信息到字符界面 { current=head->next;if(current==NULL){ cout<<“列表為空 n”;return;} cout.fill(' ');cout.width(2);cout<<“名稱”;

      cout.width(8);cout<<“價格”;cout.width(8);cout<<“數(shù)量”;cout.width(8);cout<<“總費用”;cout.width(10);cout<<“藥品的種類”;cout.width(15);cout<<“購進時間”;cout.width(15);cout<<“有效期”;cout<

      //循環(huán)輸出所有結(jié)點

      printinfor(current);

      current=current->next;}

      }//show Goods *Searchindate(Date t){ //按購入日期搜索

      返回結(jié)點指針temp //結(jié)構(gòu)體t含有t.year t.month t.day三個信息塊 Date d;bool f=false;Goods * temp;current=head->next;

      while(current!=NULL)

      {

      d=current->indate;

      if(!strcmp(d.year,t.year)&&!strcmp(d.month,t.month)&&!strcmp(d.day,t.day))

      {

      temp=current;

      f=true;

      break;

      }

      current=current->next;

      }

      if(f==false)

      {

      cout<<“n 沒有滿足要求的信息 n”;

      return NULL;

      } return temp;} void Queryindate()//按入庫日期查詢 { Date t;cout<<“ input the date(**** ** **): ”;cin>>t.year>>t.month>>t.day;

      printinfor(Searchindate(t));}//Queryindate()Goods * Searchname(char r[])//搜索藥品名

      返回結(jié)點指針temp { Goods * temp;

      current=head->next;bool f=false;

      while(current!=NULL)

      {

      if(strcmp(current->name,r)==0)

      {

      temp=current;

      f=true;

      break;

      }

      current=current->next;

      }

      if(f==false)

      {

      cout<<“n 商品名為 : ”<

      return NULL;

      } return temp;} void

      Queryname()//按藥品名查詢 { char r[MAX];cout<<“ input the name: ”;cin>>r;printinfor(Searchname(r));} void Query()//查詢函數(shù)

      一個次級菜單 { char m;do{ cout<<“ ********************************************************** ”<

      cout<<“******* 按入庫的時間查詢

      ***********”<

      cout<<“******* 按藥品的名稱查詢

      ***********”<

      cout<<“******* 退出

      ***********”<>m;switch(m){ //分別調(diào)用按不同查詢方式下的函數(shù)

      case 'a': Queryindate();break;case 'b': Queryname();break;

      case 'c': return;default: cout<<“error!”;} }while(m!='h');}//Query

      void Removebynumber()//按總量刪除某個結(jié)點 { char t[MAX];//需要刪除的總量值

      bool f=false;//表示是否找到滿足要求的結(jié)點

      Goods * temp;//指向找到的結(jié)點,并刪除

      cout<<“ 請輸入藥品的數(shù)量: ”;

      cin>>t;

      current=head;

      while(current->next!=NULL)

      {

      if(strcmp(current->next->number,t)==0)//判斷是否滿足條件

      {

      temp=current->next;

      current->next=temp->next;

      length--;//沒刪除一個結(jié)點,鏈表長度減1

      f=true;

      delete temp;//釋放結(jié)點 cout<<“已刪除此藥品n”;

      //break;

      此處屏蔽break,也就是說找到第一個滿足條件的結(jié)點,并不退出循環(huán),而是繼續(xù)刪除

      }

      else{

      current=current->next;

      }

      }

      if(f==false)//false沒有改動,表示沒有滿足條件的結(jié)點

      {

      cout<<“此藥品不存在 ,無須刪除 n”;

      } }//Removebynumber void Removebyname()//按名稱刪除某個結(jié)點 { char t[20];

      bool f=false;;

      Goods * temp;

      cout<<“ 請輸入藥品的名稱:”;

      cin>>t;

      current=head;

      while(current->next!=NULL)

      {

      if(strcmp(current->next->name,t)==0)

      {

      temp=current->next;

      current->next=temp->next;

      length--;

      f=true;

      delete temp;cout<<“已刪除此藥品n”;//break;此處屏蔽break,也就是說找到第一個滿足條件的結(jié)點,并不退出循環(huán),而是繼

      續(xù)刪除

      }

      else{

      current=current->next;

      }

      }

      if(f==false)

      {

      cout<<“此藥品不存在 ,無須刪除 n”;

      } }//Removebyname

      void Removebyindate()//按購進時間刪除某個結(jié)點 {

      Date t,d;

      bool f=false;

      Goods * temp;

      cout<<“ 請輸入查找藥品的日期: ”;

      cin>>t.year>>t.month>>t.day;

      current=head;

      while(current->next!=NULL)

      {

      d=current->next->indate;

      if(d.year==t.year&&d.month==t.month&&d.day==t.day)

      {

      temp=current->next;

      current->next=temp->next;

      length--;

      f=true;

      delete temp;cout<<“已刪除此藥品n”;

      }

      else{

      current=current->next;

      }

      }

      if(f==false)

      {

      cout<<“此元素不存在 ,無須刪除 n”;

      } }//Removebyindate

      void Remove()//刪除函數(shù)

      { char g='Y';

      do{ cout<<“ ********************************************************** ”< 按藥品總數(shù)量刪除

      ***********”< 按藥品名稱刪除

      ***********”< 按入庫時間刪除

      ***********”< 退出

      ***********”<>g;switch(g){

      case 'a': Removebynumber();break;case 'b': Removebyname();break;case 'c': Removebyindate();break;case 'd': return;default: cout<<“error!”;}

      } while(g!='d');}

      void Add(){ Goods * temp;current=head;while(current->next!=NULL)//找到尾指針 { current=current->next;} temp=new Goods;temp->next=NULL;length++;//鏈表長加1

      cout<<“ 請輸入藥品名稱: ”;

      cin>>temp->name;

      cout<<“ 請輸入單價

      : ”;

      cin>>temp->price;

      cout<<“ 請輸入藥品數(shù)量 : ”;

      cin>>temp->number;

      cout<<“ 請輸入總費用 : ”;

      cin>>temp->cost;

      cout<<“ 請輸入入購日期(**** ** **)”;

      cin>>temp->indate.year>>temp->indate.month>>temp->indate.day;

      cout<<“請輸入有效期(**** ** **)”;

      cin>>temp->xiaoqi.year>>temp->xiaoqi.month>>temp->xiaoqi.day;

      cout<<“ 請輸入藥品的種類:”<

      cin>>temp->kind;

      current->next=temp;//這時current指向尾指針,將要插入的結(jié)點接到current后面

      current=temp;}//add

      void Modify(){//通過藥品名找到要修改的數(shù)據(jù)項

      char n[MAX];cout<<“請輸入您要修改的藥品名:”<>n;

      Goods * temp=Searchname(n);//按商品名查找

      cout<<“ 請輸入單價:”;

      cin>>temp->price;

      cout<<“ 請輸入藥品的總費用:n”;

      cin>>temp->cost;

      cout<<“ 請輸入日期(**** ** **):n”;

      cin>>temp->indate.year>>temp->indate.month>>temp->indate.day;

      cout<<“ 請輸入藥品的數(shù)量:n”;

      cin>>temp->number;

      cout<<“ 請輸入藥品的種類:n”;

      cin>>temp->kind;}

      void operation(){ char g='Y';do{ cout<<“t”;cout.fill('*');cout.width(21);cout<<'*';cout<<“醫(yī)院藥房管理系統(tǒng)”;cout.fill('*');cout.width(19);cout<<'*';

      cout<<“n”;

      cout<<“t********************************************************n”;

      cout<<“t

      MWDICINE STORE MANAGEMENT SYSTERMn”;

      cout<<“t********************************************************n”;cout<<“t &&

      && 藥品入庫

      &&&&&&&&&&&&&&& cout<<”t

      &&

      && 藥品出庫

      &&&&&&&&&&&&&&&

      n“;n”;

      cout<<“t

      &&

      &&

      藥品調(diào)價

      &&&

      n”;

      cout<<“t

      &&

      &&

      新藥品入庫

      &&&

      n”;

      cout<<“t

      &&

      &&

      打開文件

      &&&&&&&&&&&&&&&

      n”;

      cout<<“t

      && &&

      保存文件

      &&&&&&&&&&&&&&&

      n”;

      cout<<“t

      &&&

      顯示庫存

      &&&

      n”;

      cout<<“t

      &&&

      藥品查詢

      &&&

      n”;

      cout<<“t

      &&&

      上下限制

      &&&

      n”;

      cout<<“t

      &&&

      退出

      &&&

      n”;

      cout<<“t********************************************************n”;

      cout<<“t********************************************************n”;cout<<“t”;cout.fill('*');cout.width(18);cout<<'*';cout<<“醫(yī)院藥房管理系統(tǒng)”;cout.fill('*');cout.width(22);cout<<'*';cout<

      cin>>g;switch(g){ case 'C':

      Creatlist();break;case 'A':

      Add();break;case 'M':

      Modify();break;case 'D':

      Show();break;case 'Q':

      Query();break;case 'R':

      Remove();break;case 'O':

      Open();break;case 'S':

      Save();break;case 'N':

      system(“cls”);break;case 'E':

      return;default: cout<<“ error!

      input the right character!!!n”;}//switch }while(g!='E');}//operation };//Cangkuguanli int main(){ Cangkuguanli A;

      A.operation();return 0;}

      第五篇:個人通訊錄管理系統(tǒng)源程序(絕對無錯)

      #include

      /*頭文件*/ #include //包含最常用的系統(tǒng)函數(shù)

      #include //關(guān)于字符數(shù)組的函數(shù)定義的頭文件

      #include //控制臺輸入輸出

      //定義結(jié)構(gòu)體

      struct tongxunlu

      /*定義通訊錄結(jié)構(gòu)體變量*/ {

      char name[20];

      /*定義輸入名字的數(shù)組*/ char phone[20];/*定義輸入電話號碼的數(shù)組*/ char adress[40];/*定義輸入地址的數(shù)組*/ } txl[100];//默認100個數(shù)據(jù)

      int n=0;//記錄數(shù)據(jù)聯(lián)系人數(shù)量

      FILE *fp;

      /*定義文件*/ //程序用到的所有函數(shù)

      void menu();

      /*主菜單函數(shù)*/ void addnew();

      /*增加聯(lián)系人函數(shù)*/ void readfile();/*文件中讀入函數(shù)*/ void writefile();/*文件中寫入函數(shù)*/ void modify();

      /*修改聯(lián)系人函數(shù)*/ void modifyname();/*姓名修改*/ void modifyphone();/*電話號碼修改*/ void search();

      /*查找聯(lián)系人函數(shù)*/ void searchname();/*按姓名查找*/ void searchphone();/*按號碼查找*/ void deletecd();

      /*刪除聯(lián)系人函數(shù)*/ void deleteall();/*全部刪除*/ void deleteone();/*單個刪除*/ void showall();

      /*號碼顯示*/ //程序主函數(shù) 模塊六

      void main()

      /*主函數(shù)main*/ { readfile();

      /*二進制讀入文件*/ while(1)

      /* 循環(huán)(永遠進行)*/ {

      menu();

      /*調(diào)用主菜單函數(shù)*/ } }

      //讀取文件函數(shù)部分開始 模塊七

      void readfile(){

      if((fp=fopen(“c: xl.txt”,“r”))==NULL)/*以只讀方式打開判定文件是否為空*/ {

      printf(“nttt

      通訊錄文件不存在”);

      /*判斷結(jié)論*/

      if((fp=fopen(“txl.txt”,“w”))==NULL)/*只寫方式判斷*/

      {

      printf(“ntt建立失敗”);

      /*為空結(jié)論*/

      exit(0);

      /*退出*/

      }

      else

      /*不為空則執(zhí)行else*/

      {

      printf(“nt-----------------歡迎使用通訊錄管理系統(tǒng)------------------”);

      printf(“nt

      通訊錄文件已建立

      ”);

      printf(“nt

      按任意鍵進入主菜單

      ”);

      printf(“nt--------------------------”);

      getch();

      return;

      }

      exit(0);

      }

      fseek(fp,0,2);/*文件位置指針移動到文件末尾*/

      if(ftell(fp)>0)/*文件不為空*/

      {

      rewind(fp);/*文件位置指針移動到文件開始位置*/

      for(n=0;!feof(fp)&& fread(&txl[n],sizeof(struct tongxunlu),1,fp);n++);

      printf(“nt----------歡迎使用通訊錄管理系統(tǒng)1.0beat版----------------”);

      printf(“nt

      文件導(dǎo)入成功

      printf(”nt

      按任意鍵返回主菜單

      printf(“nt--------------------------”);

      getch();

      return;

      }

      printf(“nt------------歡迎使用通訊錄管理系統(tǒng)1.0beat版--------------”);

      printf(“nt

      文件導(dǎo)入成功

      printf(”nt

      通訊錄文件中無任何紀(jì)錄

      printf(“nt

      按任意鍵返回主菜單

      printf(”nt--------------------------“);

      getch();

      return;}

      //讀取文件函數(shù)結(jié)束

      //文件主菜單函數(shù)開始 模塊六

      void menu(){

      char choic;

      system(”cls“);

      printf(”ntt|-------歡迎您使用通訊錄管理系統(tǒng)1.0beat版-----|“);

      printf(”ntt|

      1-添加聯(lián)系人

      2-查詢和顯示聯(lián)系人

      |“);

      printf(”ntt|

      3-刪除聯(lián)系人

      4-修改聯(lián)系人

      |“);

      ”);“);”);“);”);

      printf(“ntt|

      5-保存退出

      0-不保存退出

      |”);

      printf(“ntt|-----------------|”);

      printf(“ntt請選擇您所所要的服務(wù):”);

      choic=getch();

      switch(choic)/*對于上邊的選擇項目*/ {

      case '1':addnew();break;

      case '2':search();break;

      case '3':deletecd();break;case '4':modify();break;case '5':writefile();break;

      case '0':exit(0);

      default:menu();/*如果沒有則返回主菜單等待輸入*/ } }

      //文件主菜單函數(shù)結(jié)束

      //添加新聯(lián)系人函數(shù)開始 模塊一

      void addnew(){

      printf(“ntt------------------請輸入聯(lián)系人信息--------------------n”);

      printf(“ntt輸入聯(lián)系人姓名:”);

      scanf(“%s”,txl[n].name);

      /*鍵盤輸入*/ printf(“ntt輸入聯(lián)系人電話號碼:”);

      scanf(“%s”,txl[n].phone);

      printf(“ntt輸入聯(lián)系人地址:”);

      scanf(“%s”,txl[n].adress);

      n++;

      /*統(tǒng)計個數(shù)*/ printf(“ntt是否繼續(xù)添加聯(lián)系人?(Y/N):”);/*是否繼續(xù)輸入聯(lián)系人.*/ if(getch()=='y')

      addnew();

      return;}

      //添加新聯(lián)系人結(jié)束

      //寫入文件函數(shù)開始

      模塊七

      void writefile()

      /*聯(lián)系人寫入文件*/ {

      int i;

      if((fp=fopen(“c: xl.txt”,“w”))==NULL)

      {

      printf(“ntt文件打開失敗”);

      }

      for(i=0;i

      {

      if(fwrite(&txl[i],sizeof(struct tongxunlu),1,fp)!=1)

      {

      printf(“ntt寫入文件錯誤!n”);

      }

      }

      fclose(fp);/*關(guān)閉文件*/ printf(“nt-----------------------”);/*輸出提示信息*/ printf(“ntt通訊錄文件已保存”);

      printf(“ntt謝謝使用,歡迎再次使用!n”);printf(“如果對本軟件有疑問,請到我們官網(wǎng)(004km.cn)提出您的問題,我們將為您解答.n”);printf(“我們的軟件有不足之處,歡迎到官網(wǎng)(004km.cn)反映,我們將努力改正!”);printf(“ntt按任意鍵退出程序ntt”);

      /*輸出完畢*/ exit(0);

      printf(“nt-----------------------”);}

      //寫入文件函數(shù)結(jié)束

      ///查詢聯(lián)系人函數(shù)開始 模塊四---------------------void search(){

      char choic;

      system(“cls”);

      printf(“ntt-------------------顯示和查詢聯(lián)系人------------------”);

      printf(“ntt|

      1-逐個顯示所有

      2-按姓名查詢

      |”);

      printf(“ntt|

      3-按電話查詢

      4-返回主菜單

      |”);

      printf(“ntt|-----------------------”);

      printf(“ntt請選擇您所所要的服務(wù):”);

      choic=getch();

      switch(choic)

      {

      case '1':showall();break;

      /*顯示所有號碼*/

      case '2':searchname();break;/*調(diào)用按姓名查詢函數(shù)*/ case '3':searchphone();break;/*調(diào)用按號碼查詢函數(shù)*/ case '4':menu();break;

      /*主菜單*/ } }

      void showall()//顯示所有聯(lián)系人函數(shù)

      {

      int i;

      system(“cls”);//清楚屏幕

      if(n!=0)

      {

      printf(“ntt----------歡迎您查詢通訊錄所有聯(lián)系人信息-------------”);

      for(i=0;i

      /*依次序顯示*/

      {

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt-------------------”);

      if(i+1

      {

      printf(“ntt-----------------------”);

      system(“pause”);//返回錯誤信息

      }

      }

      printf(“ntt--------------”);

      }

      else

      /*無聯(lián)系人*/ printf(“ntt通訊錄中無任何紀(jì)錄”);

      printf(“ntt按任意鍵返回主菜單:”);

      getch();

      return;}

      //按手機號碼查詢函數(shù)

      void searchphone(){

      int mark=0;

      int i;

      char phone[15];

      printf(“ntt-------------------按電話查找-------------------------”);printf(“ntt請輸入電話號碼:”);

      scanf(“%s”,phone);

      for(i=0;i

      {

      if(strcmp(txl[i].phone,phone)==0)//對比查找函數(shù)

      {

      printf(“ntt------------以下是您查找的學(xué)生信息------------”);

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt-----------------”);

      printf(“ntt按任意鍵返回主菜單:”);

      mark++;

      getch();

      return;

      }

      }

      if(mark==0)

      {

      printf(“ntt沒有找到聯(lián)系人的信息”);

      printf(“ntt按任意鍵返回主菜單”);

      getch();

      return;

      } }

      void searchname()//按姓名查詢

      { int mark=0;

      int i;

      char name[20];

      printf(“ntt----------------按姓名查找--------------------”);printf(“ntt請輸入您要查找的姓名:”);

      scanf(“%s”,name);

      for(i=0;i

      {

      if(strcmp(txl[i].name,name)==0)

      {

      printf(“ntt------------以下是您查找的聯(lián)系人信息---------------”);

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt--------------------”);

      mark++;

      getch();

      return;

      }

      } if(mark==0)

      {

      printf(“ntt沒有找到聯(lián)系人的信息”);

      printf(“ntt按任意鍵返回主菜單”);

      getch();

      return;

      } }

      ////查詢聯(lián)系人函數(shù)結(jié)束----------------------

      ////刪除聯(lián)系人函數(shù)部分開始------------------void deletecd(){

      char choic;

      if(n==0)

      /*如果通訊錄中沒有一個記錄輸出以下部分*/

      {

      printf(“ntt對不起,文件中無任何紀(jì)錄”);

      printf(“ntt按任意鍵返回主菜單”);

      getch();

      return;

      }

      system(“cls”);

      /*清屏*/ printf(“ntt-----------------刪除菜單----------------------”);

      printf(“ntt|

      1-刪除所有 2-刪除單個

      |”);

      printf(“ntt|

      3-返回主菜單

      printf(”ntt|------------------“);

      printf(”ntt請選擇您所所要的服務(wù):“);

      choic=getch();

      /*輸入的賦予choice*/ switch(choic)

      {

      case '1':deleteall();break;

      case '2':deleteone();break;

      case '3':menu();break;

      default:menu();break;

      } }

      void deleteall()//刪除所有聯(lián)系人

      {

      printf(”ntt確認刪除?(y/n)“);

      if(getch()=='y')

      {

      fclose(fp);

      if((fp=fopen(”txl.txt“,”w“))==NULL)

      /*文件空輸出*/

      {

      printf(”ntt不能打開文件,刪除失敗“);

      readfile();

      }

      n=0;

      printf(”ntt紀(jì)錄已刪除,按任意鍵返回主菜單“);

      getch();

      return;

      }

      else

      return;}

      void deletename()//按姓名刪除聯(lián)系人

      {

      int i,j,deletemark=0,a=0;

      char name[20];

      |”);

      printf(“ntt請輸入要刪除聯(lián)系人姓名:”);

      scanf(“%s”,name);

      /*鍵盤輸入姓名*/ for(i=a;i

      {

      if(strcmp(txl[i].name,name)== 0)//對比字符串查找到要刪除的聯(lián)系人

      {

      printf(“ntt以下是您要刪除的聯(lián)系人紀(jì)錄:”);

      printf(“ntt-”);

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt-”);

      printf(“ntt是否刪除?(y/n)”);

      if(getch()=='y')// 實現(xiàn)刪除功能

      {

      for(j=i;j

      txl[j]=txl[j+1];

      /*將通訊錄的想前移*/

      n--;

      deletemark++;

      printf(“ntt刪除成功”);

      printf(“ntt是否繼續(xù)刪除?(y/n)”);

      if(getch()=='y')

      deletename();

      /*繼續(xù)調(diào)用刪除函數(shù)*/

      return;

      }

      else

      return;

      }

      continue;

      }

      if(deletemark==0)

      {

      printf(“ntt沒有該聯(lián)系人的紀(jì)錄”);

      printf(“ntt是否繼續(xù)刪除?(y/n)”);

      if(getch()=='y')

      deletename();

      return;

      } }

      void deletephone()//按電話號碼刪除聯(lián)系人

      {

      int i,j,deletemark=0;

      /*變量定義*/ char phone[20];

      printf(“ntt請輸入要刪除聯(lián)系人電話號碼:”);

      scanf(“%s”,phone);

      if(n==0)

      {

      printf(“ntt對不起,文件中無任何紀(jì)錄”);

      printf(“ntt按任意鍵返回主菜單”);

      getch();

      return;

      }

      for(i=0;i

      {

      if(strcmp(txl[i].phone,phone)==0)

      {

      printf(“ntt以下是您要刪除的聯(lián)系人紀(jì)錄:”);

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt是否刪除?(y/n)”);

      if(getch()=='y')

      {

      for(j=i;j

      txl[j]=txl[j+1];

      n--;

      deletemark++;//記錄刪除次數(shù)

      printf(“ntt刪除成功”);

      printf(“ntt是否繼續(xù)刪除?(y/n)”);

      if(getch()=='y')

      deletephone();

      return;

      }

      else

      return;

      }

      continue;

      }

      if(deletemark==0)

      {

      printf(“ntt沒有該聯(lián)系人的紀(jì)錄”);

      printf(“ntt是否繼續(xù)刪除?(y/n)”);

      if(getch()=='y')

      return;

      } }

      void deleteone()//刪除單個聯(lián)系人

      {

      char choic;

      printf(“nt---------------------------”);

      printf(“ntt

      1-按姓名刪除

      2-按電話刪除”);

      printf(“ntt請選擇您所所要的服務(wù):”);

      printf(“nt---------------------------”);choic=getch();

      switch(choic)

      {

      case '1':deletename();break;case '2':deletephone();break;} }

      ///刪除函數(shù)部分結(jié)束-------------------------

      ///修改聯(lián)系人函數(shù)開始-------------------void modify()

      /*修改函數(shù)*/ {

      char choic;

      if(n==0)

      {

      printf(“ntt對不起,文件中無任何紀(jì)錄”);

      printf(“ntt按任意鍵返回主菜單”);

      getch();

      return;

      }

      system(“cls”);

      printf(“ntt-----------------修改聯(lián)系人菜單-----------------------”);printf(“ntt|

      1-按姓名修改

      2-按電話修改

      printf(”ntt|

      任意鍵-按返回主菜單

      printf(“ntt-----------------------”);

      choic=getch();

      switch(choic)

      {

      case '1':modifyname();break;

      case '2':modifyphone();break;

      default:menu();break;} }

      void modifyname(){

      char choic;

      int i,mark=0;

      |“);|”);

      char name[20];printf(“ntt請輸入修改要聯(lián)系人的姓名:”);

      scanf(“%s”,name);if(n==0){ printf(“ntt文件中無任何聯(lián)系人”);printf(“ntt按任意鍵返回主菜單”);getch();mark++;return;

      } for(i=0;i

      printf(“ntt以下是您要修改的聯(lián)系人信息”);

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt是否修改(y/n)”);

      if(getch()=='y')

      {

      printf(“nt------------請選擇修改信息---------------”);

      printf(“nt

      1-修改姓名

      2-修改電話

      printf(”nt

      3-修改地址

      printf(“nt----------”);

      printf(“nt請選擇您所所要的服務(wù):”);

      scanf(“%s”,&choic);

      switch(choic)

      {

      case '1': printf(“nt請輸入新姓名: ”);

      scanf(“%s”,txl[i].name);break;

      case'2':printf(“nt請輸入新電話: %s”);

      scanf(“%s”,txl[i].phone);break;

      case'3':printf(“nt請輸入新地址: ”);

      scanf(“%s”,txl[i].adress);break;

      }

      } } }

      if(mark==0){ printf(“ntt沒有找到聯(lián)系人信息”);printf(“nt是否繼續(xù)修改?(Y/N):”);if(getch()=='y')

      “);”);

      modifyname();return;

      } } void modifyphone(){

      char choic,phone[15];

      int i,mark=0;

      printf(“ntt請輸入修改聯(lián)系人的號碼:”);

      scanf(“%s”,phone);

      if(n==0)

      {

      printf(“ntt文件中無任何聯(lián)系人”);

      printf(“ntt按任意鍵返回主菜單”);

      getch();mark++;

      return;

      } for(i=0;i

      if(strcmp(txl[i].phone,phone)==0)

      {

      printf(“ntt以下是您要修改的聯(lián)系人信息”);

      printf(“ntt姓名: %s”,txl[i].name);

      printf(“ntt電話: %s”,txl[i].phone);

      printf(“ntt地址: %s”,txl[i].adress);

      printf(“ntt是否修改(y/n)”);

      if(getch()=='y')

      {

      printf(“nt------------請選擇修改信息---------------”);

      printf(“nt

      1-修改姓名

      2-修改電話

      printf(”nt

      3-修改地址

      printf(“nt----------”);

      printf(“nt請選擇您所所要的服務(wù):”);

      scanf(“%s”,&choic);

      switch(choic)

      {

      case'1': printf(“nt請輸入新姓名: ”);

      scanf(“%s”,txl[i].name);break;

      case'2':printf(“nt請輸入新電話: ”);

      scanf(“%s”,txl[i].phone);break;

      case'3':printf(“nt請輸入新地址: ”);

      scanf(“%s”,txl[i].adress);break;

      }

      }

      “);”);

      } } } }

      if(mark==0){ printf(“nt沒有該聯(lián)系人信息”);printf(“nt是否繼續(xù)修改?(Y/N):”);if(getch()=='y')modifyphone();return;

      下載簡易水電費管理系統(tǒng)源程序代碼(合集五篇)word格式文檔
      下載簡易水電費管理系統(tǒng)源程序代碼(合集五篇).doc
      將本文檔下載到自己電腦,方便修改和收藏,請勿使用迅雷等下載。
      點此處下載文檔

      文檔為doc格式


      聲明:本文內(nèi)容由互聯(lián)網(wǎng)用戶自發(fā)貢獻自行上傳,本網(wǎng)站不擁有所有權(quán),未作人工編輯處理,也不承擔(dān)相關(guān)法律責(zé)任。如果您發(fā)現(xiàn)有涉嫌版權(quán)的內(nèi)容,歡迎發(fā)送郵件至:645879355@qq.com 進行舉報,并提供相關(guān)證據(jù),工作人員會在5個工作日內(nèi)聯(lián)系你,一經(jīng)查實,本站將立刻刪除涉嫌侵權(quán)內(nèi)容。

      相關(guān)范文推薦

        VB學(xué)生管理系統(tǒng)主要代碼

        主要代碼如下: Dim cn As New ADODB.Connection Dim rst0 As New ADODB.Recordset Dim rst1 As New ADODB.Recordset Dim rst2 As New ADODB.Recordset Dim rst3 As New ADO......

        簡易學(xué)生成績管理系統(tǒng)

        Option Explicit Option Base 1 Dim st() As String Dim grade() As chengji, str1$, str2$, prog() As kecheng Private Sub chengji_Click() ' 輸出序號、成績及分?jǐn)?shù) Cls......

        畢業(yè)論文 家庭圖書管理系統(tǒng)設(shè)計 源程序清單

        源程序清單應(yīng)用對象腳本:sqlca.DBMS= ProfileString ("pb.ini", "database", "dbms","") sqlca.database= ProfileString ("pb.ini", "database", "database","") sqlca.user......

        水電費收繳管理規(guī)定(范文)

        水電費收繳管理規(guī)定 1、新商戶自辦理完收租賃手續(xù)當(dāng)日起開始計收水電費。對于辦理完成租賃手續(xù)時間距水電費結(jié)算日期不足一周的計入下一周期。 2、生成水電費單據(jù)的時間為每......

        c語言火車票管理系統(tǒng)基本代碼

        #include #include #include #include int shoudsave = 0; int count1 = 0, count2 = 0, mark = 0, mark1 = 0; structtrain { }; structman { }; typedefstructnode {......

        LED數(shù)字顯示電子時鐘源程序代碼(小編推薦)

        LED數(shù)字顯示電子時鐘源程序代碼 程序:(注 已完全經(jīng)過調(diào)試,達到預(yù)期目的) #include #define uchar unsigned char #define uint unsigned int uchar count=0; sbit LED=P1^0; uc......

        簡易photoshop代碼數(shù)字圖像處理實驗報告

        一.一個簡單的“photoshop”軟件 二.設(shè)計目的: 數(shù)字圖像處理,就是用數(shù)字計算機及其他有關(guān)數(shù)字技術(shù),對圖像進行處理,以達到預(yù)期的目的。隨著計算機的發(fā)展,圖像處理技術(shù)在許多領(lǐng)域得......

        基于MFC的簡易通訊錄管理系統(tǒng)設(shè)計

        基于MFC的簡易通訊錄管理系統(tǒng)設(shè)計 目錄 一、引言 ................................................. 1 二、需求分析 ............................................. 1......