<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      Kuroki-Tomoko

      我什麼都不知道,我只知道吃飯~

      博客園 首頁 新隨筆 聯(lián)系 訂閱 管理

      C語言成績分析系統(tǒng),可以實現(xiàn)七個功能。(使用的編譯器是 code::blocks)

      1. 主要實現(xiàn)對於學生信息的輸入
      2. 顯示輸入學生的信息
      3. 根據(jù)期末成績來進行排名。
      4. 查找某個學生的信息
      5. 刪除某個學生的信息
      6. 修改某個學生的信息
      7. 退出程序

      七個不同的功能均用自定義函數(shù)來進行完成。對於函數(shù)的命名要起好對應的名字。以免造成混亂,分不清楚自己寫的函數(shù)應該放在哪個位置。

      在主函數(shù)使用 switch-case語句來實現(xiàn)函數(shù)的調(diào)用功能。

      一些遇到的問題

      1、 在codeblocks IDE中中文會出現(xiàn)亂碼的情況 

      (1) 是字體庫不匹配的原因,重新選擇字體庫可以解決輸入中文

      (2) 對IDE編輯器進行環(huán)境調(diào)試。

                    點擊Other compiler options,在空白處填寫:

                    -finput-charset=UTF-8

                    -fexec-charset=GBK

      2、 在進行學號輸入時對int和char類型的選擇

      (1)考慮到學號的長短不一,對于用戶而言,選擇相對于自由,可以選則無符號整形(學號沒有負數(shù)的可能),或者時字符型數(shù)組來進行存儲,則可以解決較長的學號。

      (2)在選擇方面,在程序中我使用了無符號的整形來儲存較長的學號,注意在使用打印printf函數(shù)時要用%lld,但是相比較而言,選擇字符型數(shù)組更好。(可以設置字符型數(shù)組char num[50])。 

      3、 在需要不同功能的函數(shù)塊可以使用新的的結(jié)構(gòu)體數(shù)組來進行快速的設定,這樣可以方便以后的查改。

      4、 在定義數(shù)組的元素個數(shù)時,可以使用宏來定義,方便程序的維護。

        1 /*程序中默認期末成績=平時分的百分之40+實驗成績的百分之60*/
        2 #include<stdio.h>
        3 #include<stdlib.h>
        4 #include <string.h>
        5 #include<stdbool.h>
        6 #define NUM 100
        7 struct Stu                    //定義學生結(jié)構(gòu)體
        8 {
        9     char name[30];            //姓名
       10     char gender[20];          //性別
       11     long long number;         //學號
       12     double Uscore;            //平時分數(shù)
       13     double Escore;            //實驗成績
       14     double Fscore;            //期末成績
       15 };
       16 
       17 struct Stu Student[100];           //一共可以儲存100個學生的信息
       18 
       19 int n;                             //全局變量
       20 int allfuction;
       21 
       22 void Exit()                        //顯示退出程序函數(shù)(結(jié)束)
       23 {
       24     system("cls");
       25     printf("\n\n\n");
       26     printf("\t\t\t****************************************************************\n");
       27     printf("\t\t\t||                                                            ||\n");
       28     printf("\t\t\t||                     Thank you to                           ||\n");
       29     printf("\t\t\t||                   use this programme !                     ||\n");
       30     printf("\t\t\t||                                                            ||\n");
       31     printf("\t\t\t||                                                            ||\n");
       32     printf("\t\t\t****************************************************************\n");
       33 }
       34 
       35 void Menu()                       //菜單
       36 {
       37 
       38     printf("                    *************************Student achievement management system************************\n");
       39     printf("                                        Please select the operation to be performed\n                                        \n");
       40     printf("                                     1 : Enter the information of students you want.\n");
       41     printf("                                     2 : Show all students information.\n");
       42     printf("                                     3 : Sort students information.\n");
       43     printf("                                     4 : Find students information.\n");
       44     printf("                                     5 : Delete students information.\n");
       45     printf("                                     6 : Modify students information\n");
       46     printf("                                     7 : Exit this system.\n");
       47     printf("Please enter your options: \n");
       48     scanf("%d",&allfuction);
       49 }
       50 
       51 int InputStudent()              //學生基本信息輸入int組
       52 {
       53     int again;
       54     int i=1;
       55     while(i)
       56     {
       57         system("cls");
       58         printf("--------------Please enter students\' information--------------\n\n\n");     //人機交互
       59         printf("Please enter the score of the number %d student:\n",i);                      //提示用戶輸入
       60         printf("Please enter student\'s ID:");
       61         scanf("%lld",&Student[i].number);                                                    //結(jié)構(gòu)體的數(shù)據(jù)輸入number
       62         printf("Please enter student\'s name:");
       63         scanf("%s",Student[i].name);                                                         //結(jié)構(gòu)體的數(shù)據(jù)輸入name
       64         printf("Please enter student\'s gender:");
       65         scanf("%s",&Student[i].gender);                                                      //結(jié)構(gòu)體的數(shù)據(jù)輸入gender
       66         printf("Please enter student\'s Semester work:");
       67         scanf("%lf",&Student[i].Uscore);                                                     //結(jié)構(gòu)體的數(shù)據(jù)輸入Uscore
       68         printf("Please enter student\'s Experimental results:");
       69         scanf("%lf",&Student[i].Escore);                                                     //結(jié)構(gòu)體的數(shù)據(jù)輸入Escore
       70         i++;                                                                                 //計數(shù)器
       71         n++;
       72         printf("Success!\n");
       73         printf("Continue to decide whether to enter information ? 1.Continue 2.Exit\n");
       74         scanf("%d",&again);                                                                  //讓用戶決定是否繼續(xù)輸入
       75         if(again == 2)
       76         {
       77             system("cls");                                                                   //清屏結(jié)束此次操作
       78             break;
       79         }
       80 
       81     }
       82 }
       83 
       84 void DisplayStudent()                          //顯示學生信息
       85 {
       86     int i = 0;                                 //初始化i計數(shù)器
       87     int pass = 0;
       88     int n_pass = 0;
       89     double percent=0.0;
       90     double percent1=0.0;
       91         system("cls");                       //清屏實現(xiàn)后續(xù)操作
       92     printf("--------------Display students\' information--------------\n\n\n");
       93     printf("ID====name====semester work====Experimental results====Final Examination====\n\n\n");
       94 
       95     for(i = 1;i <= n; i++)
       96     {
       97         Student[i].Fscore = (0.4*Student[i].Uscore) + (0.6*Student[i].Escore);      //期末成績的計算
       98         printf("Student ID:%lld\nStudent name:%s\nSemester work:%.3lf\nExperimental results:%.3lf\nFinal examination:%.3lf\n\n",
       99                Student[i].number,Student[i].name,Student[i].Uscore,Student[i].Escore,Student[i].Fscore);  //輸出學生的成績信息
      100     }
      101     if(Student[i].Fscore < 60)
      102     {
      103         ++n_pass;
      104     }
      105     else
      106     {
      107         ++pass;
      108     }
      109     percent=(double)pass/(double)n;
      110     percent1=(double)n_pass/(double)n;
      111     printf("%d students pass the assessment. %.3lf%% of the total number of students\n",pass,percent);
      112     printf("%d students not pass the assessment. %.3lf%% of the total number of students\n",n_pass,percent1);
      113 }
      114 
      115 void mysort()                       //根據(jù)成績排序名次
      116 {
      117     struct Stu t;                   //新的結(jié)構(gòu)體
      118             system("cls");
      119     printf("--------------Ranked according to final examination--------------\n\n\n");
      120     for(int i = 1; i < n; i++)
      121         for(int j = 1; j < n; j++)
      122             if(Student[j].Fscore > Student[j-1].Fscore)       //互換
      123             {
      124                 t = Student[j];
      125                 Student[j] = Student[j-1];
      126                 Student[j-1] = t;
      127             }
      128     for(int i = 1; i <= n; i++)                              //按照成績的大小來輸出具體的信息
      129     {
      130         Student[i].Fscore = (0.4*Student[i].Uscore) + (0.6*Student[i].Escore);
      131         printf("Student ID: %d\n",Student[i].number);
      132         printf("Student name: %s\n",Student[i].name);
      133         printf("Gender: %s\n",Student[i].gender);
      134         printf("Semester work: %.3lf\n",Student[i].Uscore);
      135         printf("Experimental results: %.3lf\n",Student[i].Escore);
      136         printf("Final examination: %.3lf\n\n",Student[i].Fscore);
      137     }
      138     printf("\n");
      139 }
      140 
      141 void FindStudent()                           //根據(jù)學號查找錄入學生的信息
      142 {
      143     int i=0;                                 //計數(shù)器
      144     long long ID;                            //定位學號的一個標記
      145     system("cls");
      146     printf("--------------Search by student\'s ID--------------\n\n\n");
      147     printf("Please enter the student\'s ID: ");
      148     scanf("%lld",&ID);
      149     for(i=1;i<=n;i++)
      150     {
      151         if(ID==Student[i].number)      //如果輸入的學號和存入學生信息的學號相等,進入下面的程序
      152         {
      153             Student[i].Fscore = (0.4*Student[i].Uscore) + (0.6*Student[i].Escore);
      154             printf("Student ID: %lld\n",Student[i].number);
      155             printf("Student name: %s\n",Student[i].name);
      156             printf("Gender: %s\n",Student[i].gender);
      157             printf("Semester work: %.3lf\n",Student[i].Uscore);
      158             printf("Experimental results: %.3lf\n",Student[i].Escore);
      159             printf("Final examination: %.3lf\n",Student[i].Fscore);
      160         }
      161     }
      162 }
      163 
      164 void DeleteStudent()              //刪除一個學生的信息
      165 {
      166         long long nums;                 //定義一個學號的標記
      167         int i=0;
      168         int j=0;
      169         int decide;
      170         system("cls");
      171         printf("\n============Delete information by student\' ID===========\n");
      172         printf("Enter the student ID of the student you want to delete: ");
      173         scanf("%lld",&nums);
      174 
      175         for(i=1;i<=n;i++)
      176         {
      177             if(nums==Student[i].number)            //輸入的學號與存入的學號相等進行刪除工作
      178             {
      179              Student[i].Fscore = (0.4*Student[i].Uscore) + (0.6*Student[i].Escore);
      180              printf("ID\tname\tSemester work\tExperimental results\tFinal examination\t\n");
      181              printf("%lld\t%s\t%.3lf\t%.3lf\t%.3lf\t\n",
      182                     Student[i].number,Student[i].name,Student[i].Uscore,Student[i].Escore,Student[i].Fscore);
      183 
      184              printf("Confirm the deletion !(1.Yes 2.No)\n");
      185              scanf("%d",&decide);
      186             if(decide==1)                         //輸入1則進行刪除工作
      187             {
      188                     for(j=i;j<=n;j++)
      189                     {
      190                         Student[j].number=Student[j+1].number;
      191                         strcpy(Student[j].name,Student[j+1].name);
      192                         Student[i].Uscore=Student[i].Uscore;
      193                         Student[i].Escore=Student[i].Escore;
      194                         Student[i].Fscore=Student[i].Fscore;
      195                     }
      196                     n--;
      197             }
      198             if(decide==2)                        //輸入2則取消刪除工作
      199             {
      200                 printf("Cancel deletion.");
      201             }
      202         }
      203     }
      204 }
      205 
      206 void ModifyStudent()                             //修改學生的信息
      207 {
      208     int i=0;
      209     long long IDs;
      210     system("cls");
      211     printf("--------------Please enter the student\'s ID you want to modify--------------\n\n\n");
      212     printf("Please enter the student\'s ID you want to modify:");
      213     scanf("%lld",&IDs);
      214     for(i = 1; i <= n; i++)
      215     {
      216         if(IDs==Student[i].number)
      217         {
      218             printf("Please re-enter the student's information.\n");
      219             printf("ID: \n");
      220             scanf("%lld",&Student[i].number);
      221             printf("name: \n");
      222             scanf("%s",Student[i].name);
      223             printf("Semester work: \n");
      224             scanf("%lf",&Student[i].Uscore);
      225             printf("Experimental results: \n");
      226             scanf("%lf",&Student[i].Escore);
      227             printf("Final examination: \n");
      228             scanf("%lf",&Student[i].Fscore);
      229             printf("Successful modification !\n\n");
      230         }
      231     }
      232 }
      233 
      234 int main()
      235 {
      236     while(true)
      237     {
      238         Menu();                         //顯示菜單
      239 
      240     switch(allfuction)                  //選擇swtich來進行菜單的選擇
      241     {
      242         case 1:
      243         InputStudent(Student,NUM);        //輸入學生信息
      244         break;
      245 
      246         case 2:
      247         DisplayStudent(Student,NUM);      //顯示學生信息
      248         break;
      249 
      250         case 3:
      251         mysort(Student,NUM);              //根據(jù)期末成績排序,并展示及格和不及格的人數(shù)
      252         break;
      253 
      254         case 4:
      255         FindStudent(Student,NUM);         //查找某個學生的信息
      256         break;
      257 
      258         case 5:
      259         DeleteStudent(Student,NUM);       //刪除某個學生的信息
      260         break;
      261 
      262         case 6:
      263         ModifyStudent(Student,NUM);      //修改某個學生的信息
      264         break;
      265 
      266         case 7:                          //退出整個程序
      267         Exit();
      268         return 0;
      269      }
      270     }
      271 }

      代碼運行結(jié)果以及功能展示

      1. 菜單

         

      2. 錄入信息

         

      3. 顯示信息

          

      4. 根據(jù)期末成績排名

          

      5. 查找某個學生的信息

          

      6. 刪除某個學生的信息

         

      7. 修改某個學生的信息

          

      8. 退出程序

                  

       

       

      posted on 2023-01-24 11:11  KurokiTomoko  閱讀(65)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 人妻在线中文字幕| 中文字幕乱偷无码av先锋蜜桃| 国产一区二区不卡在线视频| 高清偷拍一区二区三区| 韩国一级毛片中文字幕| 无码免费大香伊蕉在人线国产| 国产短视频精品一区二区| 亚洲男人天堂东京热加勒比 | 国产精品美女免费无遮挡 | 亚洲人亚洲人成电影网站色| 人妻聚色窝窝人体WWW一区| 少妇人妻偷人免费观看| 精品亚洲国产成人性色av| 亚洲天堂一区二区三区三州| 欧美极品色午夜在线视频| a∨变态另类天堂无码专区| 成人自拍小视频免费观看| 自拍偷在线精品自拍偷99| 亚洲 欧洲 自拍 偷拍 首页| 极品少妇的粉嫩小泬视频| 国内精品久久久久影视| 国产亚洲一级特黄大片在线| 大邑县| 成人国产一区二区三区精品| 呼和浩特市| 九九热在线观看视频免费| 精品人妻av区乱码| 色五开心五月五月深深爱| 国产精品免费视频不卡| 亚洲国产精品综合久久2007| 大地资源免费视频观看| 亚洲av成人在线一区| 亚洲av免费成人在线| 玩弄丰满少妇人妻视频| 老司机精品影院一区二区三区 | 久久精品国产亚洲av麻豆不卡| 成人av午夜在线观看| 国产久免费热视频在线观看| 国产精品中文字幕观看| 午夜福利理论片高清在线| 亚洲色大成永久WW网站|