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

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

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

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

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

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

      時(shí)間:2019-05-14 00:01:04下載本文作者:會(huì)員上傳
      簡介:寫寫幫文庫小編為你整理了多篇相關(guān)的《c語言火車票管理系統(tǒng)基本代碼》,但愿對你工作學(xué)習(xí)有幫助,當(dāng)然你在寫寫幫文庫還可以找到更多《c語言火車票管理系統(tǒng)基本代碼》。

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

      #include #include #include #include

      int shoudsave = 0;int count1 = 0, count2 = 0, mark = 0, mark1 = 0;structtrain {

      };structman {

      };typedefstructnode { structtrain data;structnode * next;char num[10];char name[10];int bookNum;char num[10];char city[10];char takeoffTime[10];char receiveTime[10];int price;int bookNum;}Node, *Link;typedefstructpeople { structman data;structpeople*next;}bookMan, *bookManLink;void printInterface(){

      puts(“********************************************************”);puts(“* Welcome to use the system of booking tickets *”);puts(“********************************************************”);puts(“* You can choose the operation: *”);puts(“* 1:Insert a train information *”);puts(“* 2:Inquire a train information *”);puts(“* 3:Book a train ticket *”);

      } puts(“* 4:Update the train information *”);puts(“* 5:Advice to you about the train *”);puts(“* 6:save information to file *”);puts(“* 7:quit the system *”);puts(“********************************************************”);/*添加一個(gè)火車信息*/

      void InsertTraininfo(Linklinkhead){

      structnode *p, *r, *s;char num[10];r = linkhead;s = linkhead->next;while(r->next!= NULL){

      printf(“please input the number of the train(0-return)”);scanf(“%s”, num);if(strcmp(num, “0”)== 0){

      } p =(structnode*)malloc(sizeof(structnode));strcpy(p->data.num, num);printf(“Input the city where the train will reach:”);scanf(“%s”, p->data.city);printf(“Input the time which the train take off:”);scanf(“%s”, p->data.takeoffTime);printf(“Input the time which the train receive:”);scanf(“%s”, &p->data.receiveTime);printf(“Input the price of ticket:”);scanf(“%d”, &p->data.price);printf(“Input the number of booked tickets:”);if(strcmp(s->data.num, num)== 0){

      } s = s->next;printf(“the train '%s'has been born!n”, num);return;break;while(s)r = r->next;while(1)

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

      p->next = NULL;

      r->next = p;

      r = p;

      shoudsave = 1;} } void printTrainInfo(structnode*p){ puts(“nThe following is the record you want:”);printf(“>>number of train: %sn”, p->data.num);printf(“>>city the train will reach: %sn”, p->data.city);printf(“>>the time the train take off: %snthe time the train reach: %sn”p->data.takeoffTime, p->data.receiveTime);printf(“>>the price of the ticket: %dn”, p->data.price);printf(“>>the number of booked tickets: %dn”, p->data.bookNum);}

      structnode * Locate1(Linkl, charfindmess[], charnumorcity[]){ Node*r;if(strcmp(numorcity, “num”)== 0){

      r = l->next;

      while(r)

      {

      if(strcmp(r->data.num, findmess)== 0)

      return r;

      r = r->next;

      } } elseif(strcmp(numorcity, “city”)== 0){

      r = l->next;

      while(r)

      {

      if(strcmp(r->data.city, findmess)== 0)

      return r;

      r = r->next;

      } } , } return 0;void QueryTrain(Linkl){

      Node *p;int sel;char str1[5], str2[10];if(!l->next){

      } printf(“Choose the way:n>>1:according to the number of train;n>>2:according to the scanf(”%d“, &sel);if(sel == 1){

      } elseif(sel == 2){

      printf(”Input the city:“);scanf(”%s“, str2);p = Locate1(l, str2, ”city“);if(p){ } printTrainInfo(p);printf(”Input the the number of train:“);scanf(”%s“, str1);p = Locate1(l, str1, ”num“);if(p){ } else {

      } mark1 = 1;printf(”nthe file can't be found!“);printTrainInfo(p);printf(”There is not any record!“);return;city:n”);

      }

      } else {

      } mark1 = 1;printf(“nthe file can't be found!”);void BookTicket(Linkl, bookManLinkk){

      Node*r[10], *p;char ch, dem;bookMan*v, *h;int i = 0, t = 0;char str[10], str1[10], str2[10];v = k;while(v->next!= NULL)v = v->next;printf(“Input the city you want to go: ”);scanf(“%s”, &str);p = l->next;while(p!= NULL){

      } printf(“nnthe number of record have %dn”, i);for(t = 0;t

      {

      printf(“ndo you want to book it?<1/0>n”);scanf(“%d”, &ch);if(ch == 1){ h =(bookMan*)malloc(sizeof(bookMan));printTrainInfo(r[t]);printf(“ntttSorry!Can't find the train for you!n”);if(i == 0)else if(strcmp(p->data.city, str)== 0){

      } p = p->next;r[i] = p;i++;

      }

      }

      } printf(“Input your name: ”);scanf(“%s”, &str1);strcpy(h->data.name, str1);printf(“Input your id: ”);scanf(“%s”, &str2);strcpy(h->data.num, str2);printf(“Input your bookNum: ”);scanf(“%d”, &dem);h->data.bookNum = dem;h->next = NULL;v->next = h;v = h;printf(“nLucky!you have booked a ticket!”);getch();shoudsave = 1;bookMan*Locate2(bookManLinkk, charfindmess[]){

      } /*修改火車信息*/ void UpdateInfo(Linkl){

      Node*p;char findmess[20], ch;if(!l->next){ printf(“nthere isn't record for you to modify!n”);bookMan*r;r = k->next;while(r){

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

      } r = r->next;mark = 1;return r;

      } } return;else {

      } QueryTrain(l);if(mark1 == 0){

      } else mark1 = 0;printf(“nDo you want to modify it?n”);getchar();scanf(“%c”, &ch);if(ch == 'y');{

      } printf(“nInput the number of the train:”);scanf(“%s”, findmess);p = Locate1(l, findmess, “num”);if(p){

      } else printf(“tttcan't find the record!”);printf(“Input new number of train:”);scanf(“%s”, &p->data.num);printf(“Input new city the train will reach:”);scanf(“%s”, &p->data.city);printf(“Input new time the train take off”);scanf(“%s”, &p->data.takeoffTime);printf(“Input new time the train reach:”);scanf(“%s”, &p->data.receiveTime);printf(“Input new price of the ticket::”);scanf(“%d”, &p->data.price);printf(“Input new number of people who have booked ticket:”);scanf(“%d”, &p->data.bookNum);printf(“nmodifying record is sucessful!n”);shoudsave = 1;void AdvicedTrains(Linkl){

      } void SaveTrainInfo(Linkl){

      FILE*fp;Node*p;int count = 0, flag = 1;fp = fopen(“D: rain.txt”, “wb”);if(fp == NULL){

      } p = l->next;while(p){

      if(fwrite(p, sizeof(Node), 1, fp)== 1){

      } p = p->next;count++;printf(“the file can't be opened!”);return;Node*r;char str[10];int mar = 0;r = l->next;printf(“Iuput the city you want to go: ”);scanf(“%s”, str);while(r){

      } if(mar == 0)printf(“ntttyou can't book any ticket now!n”);if(strcmp(r->data.city, str)== 0 && r->data.bookNum < 200){

      } r = r->next;mar = 1;printf(“nyou can select the following train!n”);printf(“nnplease select the fourth operation to book the ticket!n”);printTrainInfo(r);

      }

      } else {

      } flag = 0;break;if(flag){

      } fclose(fp);printf(“the number of the record which have been saved is %dn”, count);shoudsave = 0;void SaveBookmanInfo(bookManLinkk){

      FILE*fp;bookMan*p;int count = 0, flag = 1;fp = fopen(“D:man.txt”, “wb”);if(fp == NULL){

      } p = k->next;while(p){

      } if(flag){ printf(“the number of the record which have been saved is %dn”, count);if(fwrite(p, sizeof(bookMan), 1, fp)== 1){

      } else {

      } flag = 0;break;p = p->next;count++;printf(“the file can't be opened!”);return;

      } } shoudsave = 0;fclose(fp);int main(){

      FILE*fp1, *fp2;Node*p, *r;char ch1, ch2;Link l;bookManLink k;bookMan*t, *h;int sel;l =(Node*)malloc(sizeof(Node));l->next = NULL;r = l;k =(bookMan*)malloc(sizeof(bookMan));k->next = NULL;h = k;fp1 = fopen(“D: rain.txt”, “ab+”);if((fp1 == NULL)){

      } while(!feof(fp1)){

      } fclose(fp1);fp2 = fopen(“D:man.txt”, “ab+”);if((fp2 == NULL)){ p =(Node*)malloc(sizeof(Node));if(fread(p, sizeof(Node), 1, fp1)== 1){

      } p->next = NULL;r->next = p;r = p;count1++;printf(“can't open the file!”);return 0;

      } printf(“can't open the file!”);return 0;while(!feof(fp2)){

      } fclose(fp2);while(1){

      system(“cls”);printInterface();printf(“please choose the operation: ”);scanf(“%d”, &sel);system(“cls”);if(sel == 8){

      } switch(sel)if(shoudsave == 1){

      } printf(“nThank you!You are welcome toon”);break;getchar();printf(“nthe file have been changed!do you want to save it(y/n)?n”);scanf(“%c”, &ch1);if(ch1 == 'y' || ch1 == 'Y'){

      } SaveBookmanInfo(k);SaveTrainInfo(l);t =(bookMan*)malloc(sizeof(bookMan));if(fread(t, sizeof(bookMan), 1, fp2)== 1){

      } t->next = NULL;h->next = t;h = t;count2++;

      }

      } { case 1:

      } printf(“nplease press any key to continue.......”);getch();InsertTraininfo(l);break;QueryTrain(l);break;BookTicket(l, k);break;UpdateInfo(l);break;AdvicedTrains(l);break;SaveTrainInfo(l);SaveBookmanInfo(k);break;return 0;case 2: case 3: case 4: case 5: case 6: case 7: return 0;

      第二篇:火車票管理系統(tǒng)

      火車票管理系統(tǒng)一、課題內(nèi)容和要求

      改系統(tǒng)要求實(shí)現(xiàn)一個(gè)簡單、實(shí)用的火車票管理程序,主要功能包括火車票數(shù)據(jù)的錄入、查找、刪除、顯示、售票、退票等。所有火車票數(shù)據(jù)都要利用文件系統(tǒng)保存,以備系統(tǒng)下次運(yùn)行時(shí)使用。通過此課題,熟練掌握文件、數(shù)組、指針的各種操作,以及一些基本算法思想的應(yīng)用。

      二、需求分析

      功能框架圖:(見圖2-1)

      火車票管理系統(tǒng)

      錄入

      查找

      刪除

      排序

      售票

      退票

      保存

      圖2-1。

      1.新增火車票數(shù)據(jù)記錄:預(yù)先建立一個(gè)txt文檔,存入數(shù)據(jù),然后在程序中讀取文檔。

      2.查找火車票數(shù)據(jù)(可按車次,發(fā)車時(shí)間、起點(diǎn)站、終點(diǎn)站等查找)。

      3.刪除火車票數(shù)據(jù)記錄(先查找,再刪除。若查找出多條記錄,則進(jìn)一步提示用戶選擇記錄的車次,再刪除)。

      4.對火車票排序(可按車次、發(fā)車時(shí)間、起點(diǎn)站、終點(diǎn)站等排序。)。

      5.顯示當(dāng)前所有火車票信息列表。

      6.售票(先查找,當(dāng)確定車次后,根據(jù)售票張數(shù)對該車次的已售票人數(shù)進(jìn)行修改)。

      7.退票(售票的逆處理,過程與售票類似)。

      8.保存火車票數(shù)據(jù)到文件中。

      9.從文件中讀入火車票數(shù)據(jù)。

      三、概要設(shè)計(jì)

      1)主要結(jié)構(gòu)體:

      struct

      time

      {

      int

      hour;

      int

      minutes;

      };

      struct

      ticket

      {

      char

      SerialNumber[10];

      struct

      time

      SetOut;

      char

      DeparturePoint[MAX];

      char

      TerminalPoint[MAX];

      float

      LastTime;

      int

      FixNumber;

      int

      FixedNumber;

      }train[N];

      2)主要函數(shù)流程圖:

      l

      載入函數(shù):用于從文本中載入信息。(見圖3-1)

      打開文本

      能否打開

      讀入數(shù)據(jù)

      是否結(jié)束

      結(jié)束

      開始

      開始

      讀入車次

      是否符合輸出信息

      結(jié)束

      圖3-2

      圖3-1

      l

      查找函數(shù):利用輸入的車次或站點(diǎn)進(jìn)行順序查找并將找到的信息輸出。(見圖3-2)

      l

      刪除函數(shù):先查找出要?jiǎng)h除的信息再刪除。(見圖3-3)

      無法訂票

      人數(shù)加一

      是否超載

      圖3-4

      結(jié)束

      開始

      讀入車次

      是否誤點(diǎn)

      圖3-3

      是否符合讀入車次

      開始

      記錄下標(biāo)i

      i=i+1,i++

      i<車次總數(shù)-1

      結(jié)束

      l

      售票退票函數(shù):先判斷該車是否已發(fā)車,若未發(fā)車且人未滿則訂票成功,否則無法訂票退票。(見圖3-4)

      l

      備份文件函數(shù):將文件內(nèi)容存儲(chǔ)到用戶給定的地址中(見圖3—5)

      圖3-5

      l

      排序函數(shù)(見圖3-6)

      圖3-6

      四、源程序代碼

      #include

      #include

      #include

      #include

      #include

      #include

      const

      int

      MAX=20;

      const

      int

      N=50;

      const

      int

      MAXFILENAME=100;

      enum

      {FALSE,TRUE};

      struct

      time

      {

      int

      hour;

      int

      minutes;

      };

      struct

      ticket

      {

      char

      SerialNumber[10];

      struct

      time

      SetOut;

      char

      DeparturePoint[MAX];

      char

      TerminalPoint[MAX];

      float

      LastTime;

      int

      FixNumber;

      int

      FixedNumber;

      }train[N];

      int

      RecordNumber;

      int

      FLAG=FALSE;

      /**********************************************/

      int

      ShowMessage(void);

      //載入原始數(shù)據(jù)

      void

      mainmenu(void);

      //主菜單

      void

      InsertMessage(void);

      //錄入班次信息

      void

      SearchMenu(void);

      //查詢路線子菜單

      void

      SearchByNumber(void);

      //按班次號查詢

      void

      SearchByAddress(void);

      //按終點(diǎn)站查詢

      void

      cancle(void);//刪除數(shù)據(jù)

      void

      selection(ticket

      *pa,int

      n);//排序

      void

      TicketManagement(void);

      //車票售出與退回

      void

      TicketOrder(void);

      //售票

      void

      TicketDelete(void);

      //退票

      void

      exit(void);

      //退出該系統(tǒng)

      void

      SaveRecord(ticket

      x);

      //儲(chǔ)存信息到文件中

      /********************************************/

      int

      main(void)

      {

      do{

      mainmenu();

      }while(FLAG==FALSE);

      return

      0;

      }

      void

      mainmenu(void)

      {

      system(“mode

      con:

      cols=140

      lines=130“);

      char

      functionNumber;

      printf(“

      火車票管理系統(tǒng)\n\n“);

      printf(“============================================================================\n“);

      printf(“

      1.錄入班次信息\t\n“);

      printf(“

      2.顯示所有車票信息列表\t\n“);

      printf(“

      3.查詢火車票數(shù)據(jù)\t\n“);

      printf(“

      4.刪除火車票數(shù)據(jù)記錄\t\n“);

      printf(“

      5.按行車時(shí)間排序\t\n“);

      printf(“

      6.售票與退票系統(tǒng)\t\n“);

      printf(“

      7.退出該系統(tǒng)\t\n“);

      printf(“============================================================================\n“);

      printf(“請選擇你所需要的功能:“);

      scanf(“%c“,&functionNumber);

      switch(functionNumber)

      {

      case

      '1':

      {

      InsertMessage();

      printf(“\n按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      }

      break;

      case

      '2':

      {

      RecordNumber=ShowMessage();

      printf(“\n按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      }

      break;

      case

      '3':

      {

      SearchMenu();

      printf(“\n按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      }

      break;

      case

      '4':

      {

      cancle();

      printf(“\n按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      }

      break;

      case

      '5':

      {

      selection(train,RecordNumber);

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      int

      i;

      for(i=0;i

      {

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\n“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      }

      printf(“\n按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      }

      break;

      case

      '6':

      {

      TicketManagement();

      getchar();

      getchar();

      }

      break;

      case

      '7':

      {

      int

      i;

      FLAG=TRUE;

      for(i=0;i

      {

      SaveRecord(*(train+i));

      }

      exit();

      }

      break;

      default:

      {

      printf(“輸入錯(cuò)誤,請確保你的輸入為1--7.\n“);

      printf(“按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      }

      }//switch

      ends

      FLAG=FALSE;

      }

      void

      InsertMessage(void)

      {

      FILE

      *fp;

      char

      filename[MAXFILENAME];

      int

      i;

      printf(“請輸入文件名或者文件路徑名:“);

      scanf(“%s“,filename);

      if((fp=fopen(filename,“r“))==NULL)

      {

      printf(“文件%s不可讀,請確認(rèn)文件%s存在或者文件路徑正確.\n\n“,filename,filename);

      mainmenu();

      }

      for(i=RecordNumber;!feof(fp)&&!ferror(fp);i++)

      {

      fscanf(fp,“%s%d%d“,&train[i].SerialNumber,&train[i].SetOut.hour,&train[i].SetOut.minutes);

      fscanf(fp,“%s%s%f%d%d“,&train[i].DeparturePoint,&train[i].TerminalPoint,&train[i].LastTime,&train[i].FixNumber,&train[i].FixedNumber);

      }

      RecordNumber=i;

      /*******************************輸出更新后的訂票記錄************************************************************/

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      for(i=0;i

      {

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\n“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      }

      fclose(fp);

      }

      int

      ShowMessage(void)

      {

      int

      i;

      FILE

      *fp;

      if((fp=fopen(“add.txt“,“r“))==NULL)

      {

      printf(“讀取數(shù)據(jù)失敗,請檢查文件add.txt是否存在.\n“);

      exit(-1);

      }

      for(i=RecordNumber;!feof(fp)&&!ferror(fp);i++)

      {

      fscanf(fp,“%s%d%d“,&train[i].SerialNumber,&train[i].SetOut.hour,&train[i].SetOut.minutes);

      fscanf(fp,“%s%s%f%d%d“,&train[i].DeparturePoint,&train[i].TerminalPoint,&train[i].LastTime,&train[i].FixNumber,&train[i].FixedNumber);

      }

      int

      count=i;

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      for(i=0;i

      {

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\t“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      printf(“\n“);

      }

      return

      count;

      }

      void

      SearchMenu(void)

      {

      system(“mode

      con:

      cols=140

      lines=130“);

      char

      functionNumber;

      printf(“

      查詢子菜單\n“);

      printf(“============================================================================\n“);

      printf(“

      1.按班次號查詢\t\n“);

      printf(“

      2.按終點(diǎn)站查詢\t\n“);

      printf(“

      3.返回主菜單\t\n“);

      printf(“============================================================================\n“);

      printf(“請選擇你所需要的功能:“);

      scanf(“%*c%c“,&functionNumber);

      switch(functionNumber)

      {

      case

      '1':SearchByNumber();break;

      case

      '2':SearchByAddress();break;

      case

      '3':

      getchar();

      mainmenu();

      break;

      default:

      printf(“輸入錯(cuò)誤,請確保你的輸入為1--3.\n“);

      printf(“按任意鍵回查詢子菜單......\n“);

      getchar();

      getchar();

      SearchMenu();

      }

      }

      void

      SearchByNumber(void)

      {

      int

      i;

      char

      Number[MAX];

      printf(“請輸入班次號:“);

      scanf(“%s“,&Number);

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      for(i=0;i

      {

      //對比終點(diǎn)站記錄,找到并輸出

      if((strcmp(Number,train[i].SerialNumber))==0)

      {

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\n“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      }

      }

      }

      void

      SearchByAddress(void)

      {

      int

      i;

      char

      Address[MAX];

      printf(“請輸入終點(diǎn)站的名稱:“);

      scanf(“%s“,&Address);

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      for(i=0;i

      {

      //對比終點(diǎn)站記錄,找到并輸出

      if((strcmp(Address,train[i].TerminalPoint))==0)

      {

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\n“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      }

      }

      }

      void

      cancle(void)

      {

      SearchMenu();

      int

      i,j;

      char

      m[MAX];

      printf(“請輸入要?jiǎng)h除的班次:“);

      scanf(“%s“,&m);

      for(i=0;i

      {

      if(i==RecordNumber)

      {

      printf(“對不起,沒有這趟車\n“);

      }

      }

      for(j=i;j

      {

      train[j]=train[j+1];

      }

      printf(“刪除成功\n“);

      }

      void

      selection(ticket

      *pa,int

      n)

      {

      int

      i,k,index;

      struct

      ticket

      temp;

      for(k=0;k

      {

      index=k;

      for(i=k+1;i

      if(pa[i].LastTime

      index=i;

      if(index!=k)

      {

      temp=pa[index];

      pa[index]=pa[k];

      pa[k]=temp;

      }

      }

      }

      void

      TicketManagement(void)

      {

      char

      functionNumber;

      system(“mode

      con:

      cols=140

      lines=130“);

      printf(“

      訂票與退票菜單\n“);

      printf(“============================================================================\n“);

      printf(“

      1.訂票\t\n“);

      printf(“

      2.退票\t\n“);

      printf(“

      3.返回主菜單.\n“);

      printf(“============================================================================\n“);

      printf(“選擇你需要的功能:“);

      scanf(“%*c%c“,&functionNumber);

      switch(functionNumber)

      {

      case

      '1':

      {

      TicketOrder();

      //getchar();

      //getchar();

      }

      break;

      case

      '2':TicketDelete();break;

      case

      '3':

      {

      getchar();

      mainmenu();

      }

      break;

      default:

      {

      printf(“輸入錯(cuò)誤,請確保你的輸入為1--3.\n“);

      printf(“按任意鍵回主菜單......\n“);

      getchar();

      getchar();

      mainmenu();

      }

      }

      }

      void

      TicketOrder(void)

      {

      SearchMenu();

      int

      i,j;

      char

      a[MAX];

      printf(“請輸入要訂購的車票的班次:“);

      scanf(“%s“,&a);

      printf(“請輸入要訂購的車票的張數(shù):“);

      scanf(“%d“,&j);

      for(i=0;i

      {

      if((strcmp(a,train[i].SerialNumber))==0)

      {

      if(train[i].FixedNumber

      {

      (train[i].FixedNumber)+=j;

      printf(“你的訂票成功,請按時(shí)上車,謝謝使用!\n“);

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\n“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      }

      else

      printf(“對不起,票已賣完\n“);

      }

      }

      }

      void

      TicketDelete(void)

      {

      SearchMenu();

      int

      i,j;

      char

      b[MAX];

      printf(“請輸入要退購的車票的班次:“);

      scanf(“%s“,&b);

      printf(“請輸入要退購的車票的張數(shù):“);

      scanf(“%d“,&j);

      for(i=0;i

      {

      if((strcmp(b,train[i].SerialNumber))==0)

      {

      if(train[i].FixedNumber>=1)

      {

      train[i].FixedNumber-=j;

      printf(“退訂車票成功,謝謝使用!\n“);

      printf(“班次\t發(fā)車時(shí)間\t起點(diǎn)\t終點(diǎn)\t行車時(shí)間(小時(shí))\t額定載量\t已定票人數(shù)\n“);

      printf(“%s\t%d:%d\t\t“,train[i].SerialNumber,train[i].SetOut.hour,train[i].SetOut.minutes);

      printf(“%s\t%s\t\t%.1f\t

      %d\t\t%d\n“,train[i].DeparturePoint,train[i].TerminalPoint,train[i].LastTime,train[i].FixNumber,train[i].FixedNumber);

      }

      else

      printf(“對不起,今天的這趟車的票尚未賣出,無法完成退票!\n“);

      }

      }

      }

      void

      exit(void)

      {

      printf(“\n\n*********************謝謝使用本系統(tǒng),歡迎下次繼續(xù)使用***********************\n“);

      exit(0);

      }

      void

      SaveRecord(ticket

      x)

      {

      FILE

      *fp;

      if((fp=fopen(“add.txt“,“a“))==NULL)

      {

      printf(“打開文件%s失?。躰“,“add.txt“);

      exit(-1);

      }

      fprintf(fp,“\n%s\t%d\t%d\t\t“,x.SerialNumber,x.SetOut.hour,x.SetOut.minutes);

      fprintf(fp,“%s\t%s\t\t%.1f\t

      %d\t\t%d“,x.DeparturePoint,x.TerminalPoint,x.LastTime,x.FixNumber,x.FixedNumber);

      }

      五、測試數(shù)據(jù)及其結(jié)果分析

      顯示的主菜單界面:

      火車票管理系統(tǒng)

      ============================================================================

      1.錄入班次信息

      2.顯示所有車票信息列表

      3.查詢火車票數(shù)據(jù)

      4.刪除火車票數(shù)據(jù)記錄

      5.按行車時(shí)間排序

      6.售票與退票系統(tǒng)

      7.退出該系統(tǒng)

      ============================================================================

      請選擇你所需要的功能:

      1)錄入班次信息

      輸入:1

      輸出:請輸入文件名或者文件路徑名:

      輸入:D:\\1.txt

      輸出:

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k1111

      8:30

      南京

      上海

      4.0

      300

      200

      k1234

      10:20

      上海

      蘇州

      2.0

      200

      t2222

      12:40

      長沙

      上海

      9.0

      250

      k2323

      13:50

      揚(yáng)州

      南京

      1.5

      200

      k1122

      9:20

      廣州

      南京

      20.0

      300

      170

      按任意鍵回主菜單......2)顯示所有車票信息列表

      輸入:2

      輸出:

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k1111

      8:30

      南京

      上海

      4.0

      300

      200

      k1234

      10:20

      上海

      蘇州

      2.0

      200

      t2222

      12:40

      長沙

      上海

      9.0

      250

      k2323

      13:50

      揚(yáng)州

      南京

      1.5

      200

      k1122

      9:20

      廣州

      南京

      20.0

      300

      170

      按任意鍵回主菜單......3)查詢火車票記錄

      輸入:3

      輸出:

      查詢子菜單

      ============================================================================

      1.按班次號查詢

      2.按終點(diǎn)站查詢

      3.返回主菜單

      ============================================================================

      請選擇你所需要的功能:

      輸入:1

      輸出:請輸入班次號:

      輸入:k1111

      輸出:

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k1111

      8:30

      南京

      上海

      4.0

      300

      200

      按任意鍵回主菜單......輸入:2

      輸出:請輸入終點(diǎn)站的名稱:

      輸入:上海

      輸出:

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k1111

      8:30

      南京

      上海

      4.0

      300

      200

      t2222

      12:40

      長沙

      上海

      9.0

      250

      按任意鍵回主菜單......4)刪除火車票數(shù)據(jù)

      輸入:4

      輸出:查詢子菜單

      ============================================================================

      1.按班次號查詢

      2.按終點(diǎn)站查詢

      3.返回主菜單

      ============================================================================

      請選擇你所需要的功能:

      (查找過程同上)

      輸出:請輸入要?jiǎng)h除的班次:

      輸入:t2222

      輸出:刪除成功

      按任意鍵回主菜單......5)按行車時(shí)間排序:

      輸入:5

      輸出:

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k2323

      13:50

      揚(yáng)州

      南京

      1.5

      200

      k1234

      10:20

      上海

      蘇州

      2.0

      200

      k1111

      8:30

      南京

      上海

      4.0

      300

      200

      t2222

      12:40

      長沙

      上海

      9.0

      250

      k1122

      9:20

      廣州

      南京

      20.0

      300

      170

      按任意鍵回主菜單......6)售票

      輸入:6

      輸出:

      訂票與退票菜單

      ===================================================

      1.訂票

      2.退票

      3.返回主菜單

      ==================================================

      選擇你需要的功能:

      輸入:1

      輸出:

      查詢子菜單

      ========================================================================

      1.按班次號查詢

      2.按終點(diǎn)站查詢

      3.返回主菜單

      =========================================================================

      請選擇你所需要的功能:

      (查詢過程同上)

      輸出:請輸入需要訂購的車票班次

      輸入:k1111

      輸出:請輸入要訂購的車票張數(shù)

      輸入:10

      輸出:

      您的訂票成功,請按時(shí)上車,謝謝使用!

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k1111

      8:30

      南京

      上海

      4.0

      300

      210

      7)退票

      輸入:6

      輸出:

      訂票與退票菜單

      ===================================================

      1.訂票

      2.退票

      3.返回主菜單

      ==================================================

      選擇你需要的功能:

      輸入:2

      輸出:

      查詢子菜單

      ========================================================================

      1.按班次號查詢

      2.按終點(diǎn)站查詢

      3.返回主菜單

      =========================================================================

      請選擇你所需要的功能:

      (查詢過程同上)

      輸出:請輸入需要退購的車票班次

      輸入:k1111

      輸出:請輸入要訂購的車票張數(shù)

      輸入:5

      退訂車票成功,謝謝使用!

      班次

      發(fā)車時(shí)間

      起點(diǎn)

      終點(diǎn)

      行車時(shí)間(小時(shí))

      額定載量

      已定票人數(shù)

      k1111

      8:30

      南京

      上海

      4.0

      300

      195

      8)退出

      輸入:7

      輸出:****************謝謝使用本系統(tǒng),歡迎下次繼續(xù)使用****************

      結(jié)果分析:(1).若輸入數(shù)字不在1——7之間,則會(huì)提示錯(cuò)誤。

      (2).當(dāng)輸入列車班次信息不正確時(shí),將不會(huì)得到結(jié)果。

      (3).文件錄入不正確時(shí),將不會(huì)得到任何結(jié)果。

      六、調(diào)試過程中的問題

      1)文件存儲(chǔ)方式不正確:應(yīng)先定義一個(gè)文件存儲(chǔ)函數(shù),在其它函數(shù)中調(diào)用,方便有效。

      2)刪除時(shí)若遇到?jīng)]有的班次則程序出錯(cuò)。應(yīng)在不存在輸入的列車班次時(shí),輸出不存在的提示

      3)保存后在下次運(yùn)行時(shí)出錯(cuò)問題:在保存信息時(shí),應(yīng)在每個(gè)信息之間加一空格來保存,否則在文件下次使用時(shí)讀取就會(huì)沒有分界點(diǎn)。

      4)訂票退票只能一次一張。應(yīng)在用戶輸入列車班次后讓用戶輸入需要訂購的張數(shù)。

      5)結(jié)構(gòu)指針定義錯(cuò)誤,ticket前不應(yīng)加struct。

      第三篇:C語言課程設(shè)計(jì)火車票系統(tǒng)源代碼

      #include #include #include //火車票結(jié)構(gòu)體類型// typedef struct Node {int num;

      //編號// char name[20];

      //起點(diǎn)和終點(diǎn)// char time[5];

      //出發(fā)時(shí)間// int price;

      //車票價(jià)格// int amount;

      //剩余數(shù)量// struct Node *next;}Node;//創(chuàng)建鏈表并輸入數(shù)據(jù)// struct Node *creat(){ struct Node *head,*r,*s;

      int i=0;

      char choice;

      head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;r=head;do {

      s=(struct Node *)malloc(sizeof(struct Node));s->next=NULL;printf(“請輸入第%d種火車票的信息:n”,++i);printf(“請輸入火車的編號:”);

      scanf(“%d”,&s->num);

      printf(“起點(diǎn)和終點(diǎn):”);scanf(“%s”,s->name);printf(“出發(fā)時(shí)間:”);scanf(“%s”,s->time);printf(“車票價(jià)格:”);scanf(“%d”,&s->price);printf(“剩余數(shù)量:”);scanf(“%d”,&s->amount);

      r->next=s;

      r=s;

      printf(“Continue?(Y/N)”);scanf(“%s”,&choice);}while(choice=='Y'||choice=='y');

      r->next=NULL;return(head);} //將單鏈表中的信息保存到文件1.txt中// void save(struct Node *h){

      struct Node *s;FILE *fp;

      char filename[10]=“1.txt”;

      fp=fopen(“1.txt”,“wt”);if(fp==NULL){

      printf(“n寫文件出錯(cuò),按任意鍵退出!”);getchar();exit(1);}

      for(s=h->next;s!=NULL;s=s->next)

      fprintf(fp,“%d %s %s %d %d n”,s->num,s->name,s->time,s->price,s->amount);

      getchar();fclose(fp);} // 從文件1.txt中讀取信息并存入單鏈表中// struct Node *read(){ struct Node *head,*r,*s;FILE *fp;char filename[10]=“zl.txt”;fp=fopen(“1.txt”,“rt”);if(fp==NULL){

      printf(“讀文件錯(cuò)誤,按任意鍵退出!”);getchar();exit(1);} head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;r=head;while(!feof(fp)){

      s=(struct Node *)malloc(sizeof(struct Node));fscanf(fp,“%d %s %s %d %d”,&s->num,s->name,s->time,&s->price,&s->amount);

      r->next=s;r=s;

      } r->next=NULL;fclose(fp);

      return head;} //將鏈表中的數(shù)據(jù)輸出// void print(struct Node *h){

      struct Node *s;

      printf(“n火車票信息如下:n”);

      printf(“~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~n”);printf(“編號

      起點(diǎn)和終點(diǎn)

      出發(fā)時(shí)間

      車票價(jià)格

      剩余票數(shù):n”);

      for(s=h->next;s->next!=NULL;s=s->next){ printf(“ %d

      %10s

      %5s %10d %6dn”,s->num,s->name,s->time,s->price,s->amount);} } //鏈表查詢// struct Node * find(struct Node *h){ int i,j;char s[20];printf(“tt

      查詢方法有以下幾種:n”);printf(“tt

      1.火車票編號n”);printf(“tt

      2.起點(diǎn)和終點(diǎn)n”);printf(“tt

      3.出發(fā)時(shí)間n”);printf(“tt

      4.車票價(jià)格n”);printf(“tt

      5.剩余票數(shù)n”);printf(“請輸入您要查詢的方法的序號:”);scanf(“%d”,&i);switch(i){ case 1:printf(“請輸入你要查詢火車票的編號:”);scanf(“%d”,&j);

      while(h->next!=NULL)

      {

      h=h->next;

      if(h->num==j)return h;

      }

      return NULL;break;case 2:printf(“請輸入您要查詢火車票的起點(diǎn)和終點(diǎn):”);scanf(“%s”,s);while(h->next!=NULL){

      h=h->next;if(strcmp(h->name,s)==0)

      return h;

      } return NULL;break;case 3:printf(“請輸入您要查詢火車票的時(shí)間:”);

      scanf(“%s”,s);

      while(h->next!=NULL)

      {

      h=h->next;

      if(strcmp(h->time,s)==0)

      return h;

      }

      return NULL;

      break;case 4:printf(“請輸入你要查詢火車票的價(jià)格 :”);scanf(“%d”,&j);

      while(h->next!=NULL)

      {

      h=h->next;

      if(h->price==j)

      return h;

      }

      return NULL;

      break;case 5:printf(“請輸入你要查詢火車票的剩余票數(shù):”);scanf(“%d”,&j);

      while(h->next!=NULL)

      {

      h=h->next;

      if(h->amount==j)

      return h;

      } return NULL;

      break;} } //修改信息// change(struct Node *h,int k){ int j;struct Node *p;p=find(h);printf(“------------n”);printf(“t

      您要修改哪一項(xiàng)?n”);printf(“t

      1.火車編號n”);printf(“t

      2.起點(diǎn)和終點(diǎn)n”);printf(“t

      3.出發(fā)時(shí)間n”);printf(“t

      4.車票價(jià)格n”);

      printf(“t

      5.剩余票數(shù)n”);printf(“t

      0.退出系統(tǒng)n”);

      printf(“------------n”);printf(“請輸入您要修改項(xiàng)的編號:”);scanf(“%d”,&j);switch(j)

      { case 1:

      printf(“修改后的火車編號:”);

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

      break;

      case 2:

      printf(“修改后的起點(diǎn)和終點(diǎn):”);

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

      break;

      case 3:

      printf(“修改后的出發(fā)時(shí)間:”);

      scanf(“%s”,p->time);

      break;

      case 4:

      printf(“修改后的車票價(jià)格:”);

      scanf(“%d”,&p->price);

      break;

      case 5:

      printf(“修改后的剩余票數(shù):”);

      scanf(“%d”,&p->amount);

      break;

      case 0:break;} } //刪除信息// delete(struct Node *h){ struct Node *p;

      int j;

      printf(“請輸入您要?jiǎng)h除的火車票的編號:”);scanf(“%d”,&j);p=h->next;

      if(p==NULL)

      return 0;while(p!=NULL){ if(p->num==j){

      h->next=p->next;

      free(p);

      return 1;} h=p;p=p->next;

      } return 0;} //添加信息// void append(){

      struct Node *p;

      FILE *fp;

      fp=fopen(“1.txt”,“at+”);

      if(fp==NULL)

      {

      printf(“寫文件出錯(cuò),按任意鍵返回.n”);getchar();exit(1);

      }

      printf(“請輸入要添加的火車票的信息:火車編號,起點(diǎn)和終點(diǎn),出發(fā)時(shí)間,車票價(jià)格,剩余票數(shù):n”);scanf(“%d%s%s%d%d”,&p->num,p->name,p->time,&p->price,&p->amount);fprintf(fp,“%d %s %s %d %dn”,p->num,p->name,p->time,p->price,p->amount);getchar();fclose(fp);} //數(shù)據(jù)的統(tǒng)計(jì)// void count(struct Node *h){ struct Node *s;s=h;int i,j,k,n=0;printf(“*****************************************************************************n”);

      printf(“tt

      請選擇您要統(tǒng)計(jì)項(xiàng)目的序號:n”);

      printf(“tt

      1.車票價(jià)格n”);

      printf(“tt

      2.剩余票數(shù)n”);printf(“tt

      0.退出界面n”);

      scanf(“%d”,&i);switch(i)

      {

      case 1:

      printf(“請輸入您要統(tǒng)計(jì)車票的價(jià)格的標(biāo)準(zhǔn):”);

      scanf(“%d”,&j);

      printf(“tt

      請選擇低于或高于標(biāo)準(zhǔn):n”);

      printf(“tt

      1.價(jià)格低于%d的個(gè)數(shù)n”,j);

      printf(“tt

      2.價(jià)格高于%d的個(gè)數(shù)n”,j);

      scanf(“%d”,&k);

      if(k==1)

      {

      for(s=h->next;s->next!=NULL;s=s->next)

      if(s->price

      n++;

      printf(“車票價(jià)格低于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

      }

      else

      {

      for(s=h->next;s->next!=NULL;s=s->next)

      if(s->price>j)

      n++;

      printf(“車票價(jià)格低于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

      }

      break;

      case 2:

      printf(“請輸入您要統(tǒng)計(jì)剩余票數(shù)的數(shù)量:”);

      scanf(“%d”,&j);

      printf(“tt

      請選擇低于或高于所輸票數(shù):n”);

      printf(“tt

      1.票數(shù)低于%d的個(gè)數(shù)n”,j);

      printf(“tt

      2.票數(shù)高于%d的個(gè)數(shù)n”,j);

      scanf(“%d”,&k);

      if(k==1)

      {

      for(s=h->next;s->next!=NULL;s=s->next)

      if(s->amount

      n++;

      printf(“剩余票數(shù)低于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

      }

      else

      {

      for(s=h->next;s->next!=NULL;s=s->next)

      if(s->amount>j)

      n++;

      printf(“剩余票數(shù)高于%d的個(gè)數(shù)有%d個(gè).n”,j,n);

      }

      break;

      case 0:break;

      } } //保存用戶和密碼到文件2.txt中// void save_user(){

      char file[10]=“2.txt”;FILE *fp;char name[20];char pwd[10];fp=fopen(“2.txt”,“at+”);if(fp==NULL){ printf(“n寫文件出錯(cuò),按任意鍵退出.n”);

      getchar();exit(1);} printf(“請輸入用戶名:”);

      scanf(“%s”,name);printf(“請輸入密碼:”);

      scanf(“%s”,pwd);

      fprintf(fp,“%s %sn”,name,pwd);

      getchar();

      fclose(fp);

      printf(“用戶注冊成功!n”);} //檢驗(yàn)用戶和密碼是否匹配// int check(char *name,char *pwd){ char name1[20];char pwd1[10];FILE *fp;char file[10]=“2.txt”;if((fp=fopen(“2.txt”,“rt”))==NULL){

      printf(“讀文件出錯(cuò),按任意鍵退出!n”);

      getchar();

      exit(1);}

      while(!feof(fp)){

      fscanf(fp,“%s %s”,name1,pwd1);

      if(strcmp(name1,name)==0&&strcmp(pwd1,pwd)==0)

      return 1;} return 0;} //數(shù)據(jù)排序// void sort(struct Node *h){ struct Node *s,*p,*m,*n;int t,t1,t2,t3;char s1[20];char s2[10];

      printf(“車票價(jià)格由小到大排序如下:n”);for(s=h->next;s->next!=NULL;s=s->next)for(p=s->next;p->next!=NULL;p=p->next)

      if(s->price>p->price)

      {

      t1=s->num;s->num=p->num;p->num=t1;

      t2=s->price;s->price=p->price;p->price=t2;

      t3=s->amount;s->amount=p->amount;p->amount=t3;

      strcpy(s1,s->name);strcpy(s->name,p->name);strcpy(p->name,s1);

      strcpy(s2,s->time);strcpy(s->time,p->time);strcpy(p->time,s2);

      }

      print(h);printf(“nn剩余車票數(shù)量由多到少排序如下:n”);for(s=h->next;s->next!=NULL;s=s->next)

      for(p=s->next;p->next!=NULL;p=p->next)

      if(s->amount

      amount)

      {

      t1=s->num;s->num=p->num;p->num=t1;

      t2=s->price;s->price=p->price;p->price=t2;

      t3=s->amount;s->amount=p->amount;p->amount=t3;

      strcpy(s1,s->name);strcpy(s->name,p->name);strcpy(p->name,s1);

      strcpy(s2,s->time);strcpy(s->time,p->time);strcpy(p->time,s2);

      } print(h);} void main(){ struct Node *head,*p;int i,j,k;head=(struct Node *)malloc(sizeof(struct Node));head->next=NULL;char name[20];char pwd[10];printf(“n***************歡迎進(jìn)入火車票管理系統(tǒng)******************n”);printf(“tt 1.用戶登錄n”);printf(“tt 2.用戶注冊n”);printf(“tt 0.退出系統(tǒng) n”);printf(“請輸入所選序號:”);scanf(“%d”,&k);

      switch(k){ case 1: printf(“請輸入用戶名:”);

      scanf(“%s”,name);

      printf(“請輸入密碼:”);

      scanf(“%s”,pwd);

      if(check(name,pwd))

      {

      printf(“密碼正確.n”);

      do

      {

      printf(“nntt*********************歡迎進(jìn)入火車票管理系統(tǒng)***********************n”);

      printf(“tt

      1.錄入火車票信息tt

      2.添加火車票信息n”);

      printf(“tt

      3.修改火車票信息tt

      4.刪除火車票信息n”);

      printf(“tt

      5.打印火車票信息tt

      6.查詢火車票信息n”);

      printf(“tt

      7.統(tǒng)計(jì)火車票信息tt

      8.火車票銷售排行n”);

      printf(“tt

      0.退出系統(tǒng)n”);

      printf(“請輸入您要進(jìn)入菜單的序號(0-8):”);

      scanf(“%d”,&i);

      switch(i)

      {

      case 1:

      printf(“請錄入火車票信息nn”);

      head=creat();

      save(head);

      head=read();

      break;

      case 2:

      append();

      break;

      case 3:

      printf(“請輸入您要修改的火車票的編號:”);

      scanf(“%d”,&j);

      change(head,j);

      save(head);

      break;

      case 4:

      head=read();

      if(delete(head))

      {

      printf(“已正確刪除!n”);

      save(head);

      }

      else

      printf(“要?jiǎng)h除的結(jié)點(diǎn)不存在!n”);

      break;

      case 5:

      head=read();

      print(head);

      break;

      case 6:

      printf(“請輸入您要查詢火車票的編號(以0結(jié)束):”);

      scanf(“%d”,&j);

      {

      p=find(head);

      printf(“編號

      起點(diǎn)和終點(diǎn)

      出發(fā)時(shí)間

      車票價(jià)格

      剩余票數(shù):n”);

      printf(“%d

      %10s

      %5s %10d %6dn”,p->num,p->name,p->time,p->price,p->amount);

      printf(“請繼續(xù)輸入序號(以0結(jié)束):”);

      scanf(“%d”,&j);

      }

      break;

      case 7: head=read();count(head);break;

      case 8: sort(head);break;

      case 0: printf(“************************用!*****************************n”);break;

      }

      }while(i!=0);

      }

      else

      printf(“密碼錯(cuò)誤或用戶名不存在.n”);

      break;case 2:save_user();break;case 0:break;}

      使

      第四篇:校運(yùn)動(dòng)會(huì)管理系統(tǒng)報(bào)告C語言(含完整代碼)

      目錄 陳

      一、程序分析與設(shè)計(jì).......................................................................................................................2

      二、流程圖.......................................................................................................................................4

      三、源程序清單...............................................................................................................................4

      四、調(diào)試過程.................................................................................................................................15

      五、程序有待改進(jìn)的地方.............................................................................................................19

      六、本次實(shí)習(xí)的收獲和建議.........................................................................................................19 附錄.................................................................................................................錯(cuò)誤!未定義書簽。

      一、程序分析與設(shè)計(jì)

      (標(biāo)題四號宋體加黑,正文五號宋體,行間距-固定值18,首行縮進(jìn)2字符)

      1.題目描述

      初始化輸入:N-參賽院系總數(shù),M-男子競賽項(xiàng)目數(shù),W-女子競賽項(xiàng)目數(shù);即要求輸入一些基礎(chǔ)數(shù)據(jù),如院系名稱,每個(gè)院系參賽選手及選手編號。競賽項(xiàng)目名稱與代號。這些數(shù)據(jù)存儲(chǔ)在文本文件中,不需要每次都單條錄入。各項(xiàng)目名次取法有如下幾種:

      取前4名:第1名得分6,第2名得分4,第3名得分2,第4名得分1; 由程序提醒用戶填寫比賽結(jié)果,輸入各項(xiàng)目獲獎(jiǎng)運(yùn)動(dòng)員的信息。

      所有信息記錄完畢后,用戶可以查詢各個(gè)院系或個(gè)人的比賽成績,生成團(tuán)體總分報(bào)表,查看參賽院系信息、獲獎(jiǎng)運(yùn)動(dòng)員、比賽項(xiàng)目信息等。2.需求分析

      根據(jù)題目要求應(yīng)提供鍵盤式菜單實(shí)現(xiàn)功能選擇,還應(yīng)提供信息的輸入操作,由于在程序中提供查詢功能所以應(yīng)有顯示、查找等操作。3.總體設(shè)計(jì)

      根據(jù)上面的需求分析,可以將這個(gè)系統(tǒng)的設(shè)計(jì)分為

      1、信息輸入模塊

      2、比賽結(jié)果錄入模塊

      3、查詢模塊。具體校際運(yùn)動(dòng)會(huì)管理系統(tǒng)分為 信息的輸入、結(jié)果的輸入、學(xué)校各個(gè)項(xiàng)目的得分的查尋、總體報(bào)表的生成。4.詳細(xì)設(shè)計(jì)(1)主函數(shù)

      主函數(shù)一般設(shè)計(jì)的比較簡潔,只提供輸入,處理和輸出部分的函數(shù)調(diào)用。其中功能模塊用菜單方式選擇。(2)密碼登陸函數(shù)

      首先進(jìn)入歡迎界面,提示用戶輸入密碼進(jìn)入系統(tǒng),密碼輸入次數(shù)限制為三次,三次輸入錯(cuò)誤則退出系統(tǒng),登陸成功顯示菜單欄(3)菜單函數(shù)

      提醒用戶根據(jù)要求選擇功能,以及多次功能選?。?)輸入函數(shù)

      進(jìn)入該功能后提醒用戶輸入相應(yīng)信息,即數(shù)據(jù)結(jié)構(gòu),數(shù)據(jù)結(jié)構(gòu)采用結(jié)構(gòu)體的形式,選手結(jié)構(gòu)體成員包括選手的姓名、編號、各項(xiàng)目的成績排名、選手所在學(xué)院等。(5)查找函數(shù)

      提醒用戶輸入運(yùn)動(dòng)員的姓名或編號,根據(jù)姓名或編號逐一比對信息,若條件滿足則輸出該選手的數(shù)據(jù),若不滿足則返回‘你要找的運(yùn)動(dòng)員未找到’(6)排序函數(shù)

      根據(jù)運(yùn)動(dòng)員的百米成績進(jìn)行冒泡排序,并輸出結(jié)果(7)修改函數(shù)

      提醒用戶輸入運(yùn)動(dòng)員的姓名,根據(jù)姓名逐一比對信息,若找到則提供修改選項(xiàng),對數(shù)據(jù)進(jìn)行覆蓋(8)得分計(jì)算函數(shù)

      根據(jù)用戶輸入各項(xiàng)成績排名,進(jìn)行得分運(yùn)算 并得出學(xué)院排名(9)刪除函數(shù) 用于輸入信息的刪除(10)插入函數(shù) 用于輸入新的信息(11)保存函數(shù)

      將用戶輸入的信息保存到文本文件中(12)顯示函數(shù) 顯示用戶保存的信息

      二、流程圖

      三、源程序清單

      (此部分采用小五號宋體,行間距-固定值14)#include #include #include #include #include #define load sizeof(student)#define N 7 void read();void save();

      int size=3;struct student {

      void input()//輸入原始數(shù)據(jù)// {

      } void find()//查找函數(shù)// {

      system(“cls”);printf(“t************查找界面************n”);char fs[20];read();printf(“輸入你要查找運(yùn)動(dòng)員的號碼或姓名:”);scanf(“%s”,&fs);for(int i=0;i

      printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scor

      } else if(strcmp(stu[i].name,fs)==0){ printf(“你要找的運(yùn)動(dòng)員已找到:n”);break;if(strcmp(stu[i].num,fs)==0){ printf(“你要找的運(yùn)動(dòng)員已找到:n”);printf(“該生的號碼,姓名,100米成績,鉛球成績,跳高成績,跳遠(yuǎn)成績,系名:n”);printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);scanf(“%s%s%d%d%d%d%s”,&stu[i].num,&stu[i].name,&stu[i].scorem,&stu[i].scoreq,&stu[i].printf(“輸出運(yùn)動(dòng)員號碼,姓名,100成績,鉛球成績,跳高成績,跳遠(yuǎn)成績,系名:n”);for(i=0;i

      } printf(“該生的號碼,姓名,100米成績,鉛球成績,跳高成績,跳遠(yuǎn)成績,系名:n”);printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scor

      } } else {

      } printf(“你要找的運(yùn)動(dòng)員未找到:n”);printf(“該運(yùn)動(dòng)員缺賽或不存在!”);break;break;eq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);void paixu()//排序函數(shù)// {

      } void xiugai()//修改函數(shù)// {

      printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scorsystem(“cls”);printf(“t************修改界面************n”);char ch2[20],c;char num[10],name[20];int scorem,scoreq,scoreg,scorey,i;char ximing[20];printf(“原始數(shù)據(jù):n”);/*for(int i=0;i

      system(“cls”);printf(“t************排序界面************n”);printf(“對一百米的成績排序:n”);for(int i=0;i

      } printf(“排序后:n”);for(i=0;i

      } if(stu[i].scorem

      } temp=stu[i];stu[i]=stu[j];stu[j]=temp;

      eq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);*/

      read();printf(“輸入你要修改運(yùn)動(dòng)員的姓名:”);scanf(“%s”,ch2);for(i=0;i

      if(strcmp(stu[i].name,ch2)==0){ printf(“1.修改號碼n2.修改姓名n3.修改100米成績n4.修改鉛球成績n5.修改跳高成績n6.修改跳遠(yuǎn)成績n7.修改系名n”);

      scanf(“%d”,&c);switch(c){ case 1: { printf(“請輸入你修改的運(yùn)動(dòng)員號碼:”);scanf(“%s”,&num);strcpy(stu[i].num,num);break;} case 2: { printf(“輸入你修改的運(yùn)動(dòng)員姓名:n”);scanf(“%s”,&name);strcpy(stu[i].name,name);break;} case 3: { printf(“輸入你修改的運(yùn)動(dòng)員100米成績:”);scanf(“%d”,&scorem);stu[i].scorem=scorem;break;} case 4: { printf(“輸入你修改運(yùn)動(dòng)員鉛球成績:”);scanf(“%d”,&scoreq);stu[i].scoreq=scoreq;break;} case 5: { printf(“輸入你修改運(yùn)動(dòng)員跳高成績:”);scanf(“%d”,&scoreg);stu[i].scoreq=scoreq;break;} case 6: {

      }

      } printf(“輸入你修改運(yùn)動(dòng)員跳遠(yuǎn)成績:”);scanf(“%d”,&scorey);stu[i].scorey=scorey;break;case 7: {

      } default: } printf(“修改后的運(yùn)動(dòng)員數(shù)據(jù):n”);for(int i=0;i

      if(stu[i].scoreq==1)y=3;else if(stu[i].scoreq==2)y=2;else if(stu[i].scoreq==3)y=1;else y=0;printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scorread();printf(“各系的得分總分排序:n”);for(i=0;i

      if(stu[i].scorem==1)x=3;else if(stu[i].scorem==2)x=2;else if(stu[i].scorem==3)x=1;else x=0;eq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);*/ system(“cls”);printf(“t************得分界面************n”);int x,y,z,w,o,p,q,i;char ch1[20]=“ruanjian”,ch2[20]=“shumei”,ch3[20]=“guangdian”;printf(“原始數(shù)據(jù):n”);/*for(int i=0;i

      }

      } if(stu[i].scoreg==1)z=3;else if(stu[i].scoreg==2)z=2;else if(stu[i].scoreg==3)z=1;else z=0;if(stu[i].scorey==1)w=3;else if(stu[i].scorey==2)w=2;else if(stu[i].scorey==3)w=1;else w=0;for(i=0;i

      } if(strcmp(stu[i].ximing,ch1)==0){

      } else if(strcmp(stu[i].ximing,ch2)==0){

      } else if(strcmp(stu[i].ximing,ch3)==0){

      } q=x+y+z+w;printf(“光電系總得分:%dn”,q);

      p=x+y+z+w;printf(“數(shù)媒系總得分:%dn”,p);o=x+y+z+w;printf(“軟件系總得分:%dn”,o);void shancchu()//刪除函數(shù)// {

      printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scorread();printf(“輸入你要?jiǎng)h除的運(yùn)動(dòng)員的姓名:n”);scanf(“%s”,&ch1);for(i=0;i

      if(strcmp(stu[i].name,ch1)==0){ for(int j=i;j

      } {

      } } stu[j]=stu[j+1];printf(“刪除后的運(yùn)動(dòng)員數(shù)據(jù):n”);for(i=0;i

      void charu()//插入函數(shù)

      system(“cls”);int a;printf(“t************插入界面************n”);printf(“請輸入要插入的運(yùn)動(dòng)員個(gè)數(shù):”);scanf(“%d”,&a);for(int j=0;j

      } printf(“輸入要插入的運(yùn)動(dòng)員數(shù)據(jù):n”);printf(“號碼:”);scanf(“%s”,&stu[size].num);printf(“姓名:”);scanf(“%s”,&stu[size].name);printf(“100米成績:”);scanf(“%d”,&stu[size].scorem);printf(“鉛球成績:”);scanf(“%d”,&stu[size].scoreq);printf(“跳高成績:”);scanf(“%d”,&stu[size].scoreg);printf(“跳遠(yuǎn)成績:”);scanf(“%d”,&stu[size].scorey);printf(“系名:”);scanf(“%s”,&stu[size].ximing);for(int i=0;i

      for(int j=i+1;j

      if(stu[i].scorem

      } temp=stu[i];stu[i]=stu[j];stu[j]=temp;size++;printf(“插入后運(yùn)動(dòng)員數(shù)據(jù):n”);for(int i=0;i

      } void save(){

      } void read(){

      } printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scor} fclose(fp);

      //關(guān)閉文件 eq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);fscanf(fp,“%st%st%dt%dt%dt%dt%sn”,&stu[i].num,&stu[i].name,&stu[i].scorem,&stu[i].scoreq,&stu[i].scoreg,&stu[i].scorey,&stu[i].ximing);for(int i=0;i

      if((fp=fopen(“e:xiao.txt”,“r”))==NULL){

      } fscanf(fp,“運(yùn)動(dòng)員號碼,姓名,100成績,鉛球成績,跳高成績,跳遠(yuǎn)成績,系名:n”);printf(“打不開文件Cannot open the filen”);return;

      //若打不開則返回菜單

      //為輸出打開一個(gè)二進(jìn)制文件,為只fprintf(fp,“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].fclose(fp);

      //關(guān)閉文件 scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);printf(“保存成功....Save the file successfully!n”);FILE *fp;

      //定義指向文件的指針

      //char outfile[20];//printf(“輸出文件例如:c:score Enter outfile name,for example c:scoren”);//scanf(“%s”,outfile);if((fp=fopen(“e:xiao.txt”,“w”))==NULL){

      } printf(“n保存中...Saving the file......n”);//fprintf(fp,“運(yùn)動(dòng)員號碼,姓名,100成績,鉛球成績,跳高成績,跳遠(yuǎn)成績,系名:n”);for(int i=0;i

      //若打不開則返回菜單

      //為輸出打開一個(gè)二進(jìn)制文件,為只

      //保存數(shù)據(jù)到文件函數(shù) printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scorsave();eq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);寫方式

      寫方式 int login(char password[]){

      //密碼校對函數(shù)*********** static char key[10]=“12345”;if(strcmp(password,key)==0)return 1;else return 0;}

      void Logon(){

      } if(s==0){

      count++;while(count!=3){

      printf(“請?jiān)俅屋斎朊艽a:n”);scanf(“%s”,password);s=login(password);if(s==1)char a;printf(“n”);printf(“****************歡迎進(jìn)入校運(yùn)動(dòng)會(huì)管理界面****************n”);printf(“********************************************************n”);printf(“********************登陸請按回車鍵**********************n”);printf(“********************************************************n”);printf(“n”);scanf(“%c”,&a);if(a=='n'){

      FILE *fp;char password[10];int count=0,s;printf(“您有三次輸入機(jī)會(huì)!nn”);printf(“請輸入密碼:n”);scanf(“%s”,password);s=login(password);if(s==1){

      fp=fopen(“C:UsersAdministratorDesktop實(shí)訓(xùn)password.txt”,“w”);fprintf(fp,“%s”,password);fclose(fp);system(“CLS”);printf(“密碼正確!n”);printf(“********************************************************n”);printf(“***************************歡迎進(jìn)入*********************n”);printf(“********************************************************nnn”);

      //比較輸入字符和系統(tǒng)設(shè)定的密碼是否相同

      }

      }

      }

      } {

      fp=fopen(“C:UsersAdministratorDesktop實(shí)訓(xùn)fprintf(fp,”%s“,password);fclose(fp);system(”CLS“);printf(”密碼正確!n“);password.txt”,“w”);printf(“********************************************************n”);printf(“***************************歡迎進(jìn)入*********************n”);printf(“********************************************************n”);} if(s==0)count++;return;if(count==3)printf(“你已經(jīng)錯(cuò)誤輸入3次,系統(tǒng)退出!n”);exit(0);else exit(1);void menu(){

      int ch1;char ch2;struct tm *pt;/*定義時(shí)間結(jié)構(gòu)體*/ time_t t;t=time(NULL);pt=localtime(&t);/*讀取系統(tǒng)日期并把它放到結(jié)構(gòu)體中*/ do{

      { printf(“tt當(dāng)前系統(tǒng)日期:%d-%d-%dn”,pt->tm_year+1900,pt->tm_mon+1,pt->tm_mday);printf(“======================菜單=====================n”);printf(“ 1.輸入 printf(” 3.排序 printf(“ 5.得分 printf(” 7.插入 printf(“ 9.顯示

      2.查找 4.修改 6.刪除 8.保存

      n”);n“);n”);n“);/*顯示當(dāng)前系統(tǒng)日期*/

      0.退出n”);printf(“=n”);printf(“請選擇功能<1-8>:[ ]bb”);//getchar();scanf(“%d”,&ch1);switch(ch1)

      }

      }

      case 1:

      input();break;find();break;paixu();break;xiugai();break;defen();break;shancchu();break;charu();break;save();break;read();break;exit(0);printf(“未進(jìn)行任何操作!”);case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 0: default: printf(“n”);printf(“想要繼續(xù)操作請按yn”);getchar();scanf(“%2c”,&ch2);

      //條件判斷 }while(ch2=='y');

      void main(){

      } system(“color 3f”);//Logon();menu();

      四、調(diào)試過程

      在程序運(yùn)行的過程中,出現(xiàn)了很多的錯(cuò)誤。有很復(fù)雜的問題,也不乏許多低級的錯(cuò)誤。在寫入文件的時(shí)候,首先我用的是fwrite,而在讀入文件的時(shí)候用的是fread,后來才發(fā)現(xiàn)這兩個(gè)語句都只是對二進(jìn)制的文件進(jìn)行操作,實(shí)際上我們要用到的fscanf、fprintf這兩個(gè)語句。修改完的代碼 FILE *fp;//定義指向文件的指針 if((fp=fopen(“e:xiao.txt”,“r”))==NULL)

      //為輸出打開一個(gè)二進(jìn)制文件,為只寫方式

      fscanf(fp,“%st%st%dt%dt%dt%dt%sn”,&stu[i].num,&stu[i].name,&stu[i].scorem,for(int i=0;i

      }

      fscanf(fp,“運(yùn)動(dòng)員號碼,姓名,100成績,鉛球成績,跳高成績,跳遠(yuǎn)成績,系名:n”);printf(“打不開文件Cannot open the filen”);return;

      //若打不開則返回菜單

      &stu[i].scoreq,&stu[i].scoreg,&stu[i].scorey,&stu[i].ximing);printf(“%st%st%dt%dt%dt%dt%sn”,stu[i].num,stu[i].name,stu[i].scorem,stu[i].scoreq,stu[i].scoreg,stu[i].scorey,stu[i].ximing);} fclose(fp);

      //關(guān)閉文件 做菜單功能多次選擇時(shí),令用戶輸入字符進(jìn)行選擇,然而程序總是退出,后來才知道‘n’也被算入用戶輸入的字符內(nèi),要在字符輸入后添加getchar()才能避免菜單失效 做顯示函數(shù),屏幕顯示異常,總是反復(fù)顯示相同數(shù)據(jù)和亂碼,原來是結(jié)構(gòu)體初始化,當(dāng)中的數(shù)組已經(jīng)存儲(chǔ)了數(shù)據(jù),在顯示時(shí)與函數(shù)同時(shí)輸出了,要再定義一個(gè)相同的數(shù)組應(yīng)用它輸出。(1)登陸

      (2)菜單

      (3)輸入

      (4)查找

      (5)排序

      (6)修改

      (7)得分

      (8)刪除

      (9)插入

      (10)保存

      (11)退出

      五、程序有待改進(jìn)的地方

      六、本次實(shí)習(xí)的收獲和建議

      通過這次課程設(shè)計(jì)我得出一個(gè)結(jié)論:知識必須通過應(yīng)用才能實(shí)現(xiàn)其價(jià)值!有些東西以為學(xué)會(huì)了,但真正到用的時(shí)候才發(fā)現(xiàn)是兩回事,所以我認(rèn)為只有到真正會(huì)用的時(shí)候才是真的學(xué)會(huì)了。同時(shí)在設(shè)計(jì)的過程中發(fā)現(xiàn)了自己的不足之處,對一些前面學(xué)過的知識理解得不夠深刻,掌握得不夠牢固,比如說指針。編程時(shí)要養(yǎng)成良好的風(fēng)格,注意相同內(nèi)容的縮進(jìn)和對齊。這樣做,可以使程序代碼出錯(cuò)的情況下,可以快速并且便捷的查找到錯(cuò)誤的行,利于很好的修改。

      在整個(gè)設(shè)計(jì)中我懂得了許多東西,也培養(yǎng)了我獨(dú)立工作的能力,樹立了對自己工作能力的信心,相信會(huì)對今后的學(xué)習(xí)工作生活有非常重要的影響。而且大大提高了動(dòng)手的能力,使我充分體會(huì)到了在創(chuàng)造過程中探索的艱難和成功時(shí)的喜悅。雖然這個(gè)設(shè)計(jì)做的也不太好,但是在設(shè)計(jì)過程中所學(xué)到的東西是這次課程設(shè)計(jì)的最大收獲和財(cái)富,使我終身受益。

      在本次實(shí)踐中,給我印象最為深刻的是在文件刪除程序的編譯過程中,這個(gè)程序?qū)⑹顷P(guān)鍵。老天不會(huì)讓我太過順利,他在這最后的時(shí)刻設(shè)置的障礙,但是我鼓起勇氣,到處查找資料,終于讓我實(shí)現(xiàn)了這個(gè)函數(shù),謝謝給我指點(diǎn)迷津的朋友和同學(xué)。對我而言,知識上的收獲重要,精神上的豐收是可喜的。挫折是一份財(cái)富,經(jīng)歷是一份擁有。這次實(shí)際操作必將成為我們?nèi)松猛旧弦粋€(gè)非常美好的回憶!

      第五篇:火車票管理系統(tǒng)可行性報(bào)告(本站推薦)

      火車票管理系統(tǒng)可行性報(bào)告

      一.引言

      學(xué)習(xí)《面向?qū)ο蟪绦蛟O(shè)計(jì)》課程必須重視實(shí)踐環(huán)節(jié),即通過C#結(jié)合實(shí)際需求開發(fā)應(yīng)用程序。本次課程實(shí)習(xí)選擇使用C#開發(fā)數(shù)據(jù)庫應(yīng)用程序,它能將所學(xué)的C#整合SQL Server數(shù)據(jù)庫知識,形成與應(yīng)實(shí)際緊密結(jié)合的連貫整體,進(jìn)一步加深學(xué)生對C#基礎(chǔ)語法的理解,加強(qiáng)對WinForms編程的認(rèn)識,提高應(yīng)用ADO.NET這一.NET中數(shù)據(jù)庫驅(qū)動(dòng)解決方案核心技術(shù)的能力,為將來的軟件設(shè)計(jì)工作打下一定的基礎(chǔ)。

      該課程的實(shí)習(xí)主要是鍛煉學(xué)生的實(shí)際動(dòng)手與操作的能力,充分實(shí)現(xiàn)理論與實(shí)踐相結(jié)合,從而培養(yǎng)出優(yōu)秀的學(xué)生!

      1.摘要

      系統(tǒng)名稱: 火車票管理系統(tǒng)

      系統(tǒng)功能: 實(shí)現(xiàn)管理員對系統(tǒng)的增刪改查等一系列的功能,讓客戶可以訂票、退票等,該系統(tǒng)只要實(shí)現(xiàn)簡單的操作功能。

      2.背景

      揚(yáng)州環(huán)境資源職業(yè)技術(shù)學(xué)院1012網(wǎng)絡(luò)班小組成員在C#面向?qū)ο蟪绦蛟O(shè)計(jì)該課程的實(shí)訓(xùn)周內(nèi)進(jìn)行的課程實(shí)訓(xùn),借此提高學(xué)生的動(dòng)手能力,理論與實(shí)踐相結(jié)合的能力;該系統(tǒng)主要是在Visual Studio C# 2005的基礎(chǔ)上與SQL數(shù)據(jù)庫相結(jié)合而成的面向?qū)ο蟮某绦蛟O(shè)計(jì)系統(tǒng)。

      二.系統(tǒng)開發(fā)的背景、必要性及意義

      1.現(xiàn)行系統(tǒng)調(diào)查研究

      (1)組織機(jī)構(gòu):揚(yáng)州環(huán)境資源職業(yè)技術(shù)學(xué)院 1012網(wǎng)絡(luò)班;指導(dǎo)老師:陳彥(2)實(shí)訓(xùn)時(shí)間:2011年12月26日至2012年1月6日

      (3)小組成員:徐濤平(組長)、,孫淑茵、孫垚垚、,夏盼盼、,柏銘慧、,華飛龍、,陳龍、,顧漢明

      (4)成員任務(wù):徐濤平、,孫垚垚、,夏盼盼、,柏銘慧、,華飛龍、,陳龍、,顧漢明負(fù)責(zé)系統(tǒng)相關(guān)文檔的編寫;,柏銘慧負(fù)責(zé)前期的數(shù)據(jù)庫設(shè)計(jì);孫淑茵負(fù)責(zé)設(shè)計(jì)后期與系統(tǒng)相連接的數(shù)據(jù)庫DB的設(shè)計(jì),并負(fù)責(zé)系統(tǒng)的編碼編寫。

      (5)計(jì)算機(jī)應(yīng)用情況:臺(tái)式機(jī)裝有Visual Studio C# 2005和SQL數(shù)據(jù)庫 2.需求調(diào)查和分析

      對于現(xiàn)在網(wǎng)絡(luò)的迅速發(fā)展,人們越來越關(guān)注網(wǎng)絡(luò)。人們在網(wǎng)絡(luò)上進(jìn)行交易,購物,訂餐等。在網(wǎng)上進(jìn)行訂票也越來越受人們的歡迎。鑒于這種情況,本人孫淑茵想要開發(fā)一個(gè)類似的系統(tǒng),故而有了現(xiàn)在的火車票管理系統(tǒng)。

      該系統(tǒng)由于是本人的初次嘗試開發(fā),所以功能比較的簡單,還存在不足之處。

      三.可行性分析

      1.系統(tǒng)運(yùn)行可行性分析 該系統(tǒng)只需要一臺(tái)裝有Visual Studio C# 2005和SQL數(shù)據(jù)庫的的電腦就可以進(jìn)行運(yùn)行,對于企業(yè)來說,這是最簡單的、最實(shí)用的系統(tǒng)了;對于人員來說,不需要花費(fèi)大量的金錢進(jìn)行人員的培訓(xùn),只需要招聘一個(gè)相關(guān)專業(yè)的計(jì)算機(jī)人員,就可以對系統(tǒng)進(jìn)行操作。2.技術(shù)可行性

      火車票管理系統(tǒng)功能簡單,對人員要求以及技術(shù)要求不高,在這方面,只需要一個(gè)計(jì)算機(jī)相關(guān)專業(yè)的人員就可以操作系統(tǒng),在技術(shù)上完全可以進(jìn)行。3.經(jīng)濟(jì)可行性

      在經(jīng)濟(jì)上,不需要額外的費(fèi)用,只需要付費(fèi)開發(fā)人員即可,可以說是一勞永逸,在后期,不需要企業(yè)花費(fèi)費(fèi)用,只需要技術(shù)人員進(jìn)行定期的維護(hù)即可,在經(jīng)濟(jì)上完全可行。

      四.系統(tǒng)功能簡單介紹

      1.數(shù)據(jù)庫

      火車票管理系統(tǒng)連接的數(shù)據(jù)庫主要是SQL數(shù)據(jù)庫,數(shù)據(jù)庫的名稱為DB.mdb,它包括了Stype表、Train表和UserInfo表三張表,由于時(shí)間匆忙,所以只有這三張表,進(jìn)而組成與系統(tǒng)相連接的數(shù)據(jù)庫。詳見下圖4.1

      圖4.1 2.系統(tǒng)功能介紹

      火車票管理系統(tǒng)功能比較簡單,管理員可以對系統(tǒng)進(jìn)行增刪改查,而一般的瀏覽者就可以對系統(tǒng)進(jìn)行相應(yīng)的查票、訂票、退票操作,而不能像管理員那樣對系統(tǒng)進(jìn)行增刪改查等操作,從而保證了系統(tǒng)的安全性。下圖是系統(tǒng)的相關(guān)截圖,如圖4.2、4.3所示:

      圖4.2

      圖4.3 五.結(jié)論

      在2011年12月26日至2012年1月6日實(shí)訓(xùn)期間,小組成員團(tuán)結(jié)協(xié)作,共同努力,完成了火車票管理系統(tǒng)的開發(fā),在這個(gè)過程中每個(gè)成員的努力都市值得褒獎(jiǎng)的,尤其是負(fù)責(zé)代碼編寫的孫淑茵為我們的系統(tǒng)完成與完善更是值得獎(jiǎng)勵(lì)的。

      火車票管理系統(tǒng)功能簡單,實(shí)現(xiàn)方便,但也耗費(fèi)了人力物力與心力,能在短時(shí)間內(nèi)開發(fā)出這樣一個(gè)的系統(tǒng),我們的努力是值得肯定的,但是這個(gè)系統(tǒng)還存在著不足之處,有望在以后的日子里,對系統(tǒng)進(jìn)行改善和維護(hù)。

      六.說明

      在這里,對相關(guān)的問題做一些說明:

      1.我們是軟件技術(shù)基礎(chǔ)實(shí)訓(xùn)和C#課程實(shí)訓(xùn)前后進(jìn)行的,軟件技術(shù)基礎(chǔ)實(shí)訓(xùn)在前,分組也是在軟件技術(shù)基礎(chǔ)實(shí)訓(xùn)期間分的,相關(guān)的文檔也是在此期間完成的,代碼也是在此期間編寫完成,只是比較不完善,而且在軟件技術(shù)基礎(chǔ)實(shí)訓(xùn)期間小組成員負(fù)責(zé)前期數(shù)據(jù)庫設(shè)計(jì)出的數(shù)據(jù)庫并不能用,都是中文,并且表與表之間沒有相關(guān)的聯(lián)系,所以負(fù)責(zé)代碼編寫的孫淑茵就自己設(shè)計(jì)了一個(gè)數(shù)據(jù)庫DB。

      2.在后來的C#實(shí)訓(xùn)期間,小組成員孫淑茵自己對軟件技術(shù)基礎(chǔ)實(shí)訓(xùn)期間不完善的火車票管理系統(tǒng)進(jìn)行了改進(jìn),在陳彥老師的指導(dǎo)下,才有了后來的完善的火車票管理系統(tǒng),可以說這個(gè)火車票管理系統(tǒng)是孫淑茵同學(xué)的私有產(chǎn)物,與小組其他成員關(guān)系不大,在此說明一下。

      下載c語言火車票管理系統(tǒng)基本代碼word格式文檔
      下載c語言火車票管理系統(tǒng)基本代碼.doc
      將本文檔下載到自己電腦,方便修改和收藏,請勿使用迅雷等下載。
      點(diǎn)此處下載文檔

      文檔為doc格式


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

      相關(guān)范文推薦