




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
1、 內(nèi)蒙古科技大學(xué) 本科生課程設(shè)計說明書題 目:C語言課程設(shè)計 學(xué)生基本信息管理系統(tǒng)學(xué)生姓名:吳艷芳學(xué) 號:1468100536專 業(yè):軟件工程班 級:一班指導(dǎo)教師:康懿日 期: 2016 年1 月 5 日內(nèi)蒙古科技大學(xué)課程設(shè)計任務(wù)書課程名稱C語言課程設(shè)計設(shè)計題目學(xué)生基本信息管理系統(tǒng)指導(dǎo)教師康懿時間2015.1.51.9一、教學(xué)要求1. 鞏固和加深學(xué)生對C語言課程的基本知識的理解和掌握2. 掌握C語言編程和程序調(diào)試的基本技能3. 利用C語言進行基本的軟件設(shè)計4. 掌握書寫程序設(shè)計說明文檔的能力5. 提高運用C語言解決實際問題的能力二、設(shè)計資料及參數(shù)每個學(xué)生在教師提供的課程設(shè)計題目中任意選擇一題,
2、獨立完成,題目選定后不可更換。某班學(xué)生成績管理,包括以下功能:5 從鍵盤輸入包括學(xué)號、姓名、各門課程成績(不少于5門),并將其保存在磁盤文件里6 打開文件后,計算每個人的總分和平均分,排序并保存7 具有單項查詢或多項查詢的功能(即按照給定的關(guān)鍵字,如姓名找出滿足條件的紀錄)8 具有插入、刪除和修改功能9 具有輸出文件數(shù)據(jù)信息的功能三、設(shè)計要求及成果1. 分析課程設(shè)計題目的功能需求(可選用數(shù)組或鏈表實現(xiàn),可多人(最多3人)協(xié)作完成一個題目)2. 寫出詳細設(shè)計說明(至少包括功能實現(xiàn)分析和模塊流程圖)3. 編寫程序代碼,調(diào)試程序使其能正確運行(代碼書寫要規(guī)范,標示符要見名知意,要有必要的注釋,每人至
3、少500行代碼,不包括注釋和花括號)4. 設(shè)計完成的軟件要便于操作和使用5. 設(shè)計完成后提交課程設(shè)計報告(請嚴格按照模板進行排版)四、進度安排第一天 選擇課程設(shè)計題目,分析課題的要求第二天 編程第三天 編程及調(diào)試第四天 寫課程設(shè)計報告第五天 提交課程設(shè)計報告(打印稿及電子稿)五、評分標準1. 根據(jù)平時上機考勤、表現(xiàn)和進度,教師將每天點名和檢查2. 根據(jù)課程設(shè)計完成情況,必須有可運行的軟件。3. 根據(jù)課程設(shè)計報告的質(zhì)量,如有雷同,則所有雷同的所有人均判為不及格。六、建議參考資料1C語言程序設(shè)計,譚浩強,清華大學(xué)出版社2C語言程序設(shè)計課程
4、設(shè)計,劉振安,機械工業(yè)出版社目 錄內(nèi)蒙古科技大學(xué)I本科生課程設(shè)計說明書I內(nèi)蒙古科技大學(xué)課程設(shè)計任務(wù)書II目 錄III第一章 需求分析41.1引言41.2任務(wù)概述41.3數(shù)據(jù)描述41.4功能需求41.5任務(wù)計劃5第2章概要設(shè)計52.1總體設(shè)計52.2數(shù)據(jù)類型設(shè)計(或數(shù)據(jù)結(jié)構(gòu)設(shè)計)62.3接口設(shè)計62.4運行界面設(shè)計7第3章詳細設(shè)計113.1輸入模塊設(shè)計113.2輸出模塊設(shè)計123.3查找模塊設(shè)計133.4排序模塊設(shè)計143.5保存及讀取模塊設(shè)計16第4章測試分析194.1測試程序執(zhí)行情況194.2出現(xiàn)的問題和解決的方法19第5章課程設(shè)計總結(jié)20附錄:程序代碼21參考文獻40第一章 需求分析1.1
5、 引言隨著學(xué)生人數(shù)的增多,學(xué)生信息管理變得越來越困難,為了方便學(xué)校對學(xué)生信息的管理,一個簡易的學(xué)生信息管理系統(tǒng)可以解決一些簡單的問題。能幫助我們快速找到學(xué)生信息。1.2 任務(wù)概述1.建立學(xué)生信息,信息包括學(xué)生姓名,學(xué)號,性別,年齡,地址,電話等。2.能夠提供錄入、瀏覽、查找、修改和刪除信息的功能。3.能夠提供按不同方式查詢的功能;如:按姓名查找或者按電話查找等。1.3 數(shù)據(jù)描述struct studentlong num;char name15;int age;char sex3;char dizhi20;char phone11;struct student *next;1.4 功能需求1.
6、錄入功能:一次可以完成自定義學(xué)生人數(shù)的學(xué)生信息記錄的錄入。2.刪除功能:對指定學(xué)生的信息進行刪除。3.修改功能:對指定學(xué)生的信息進行修改。4.查詢功能:選擇某種方式并輸入該信息查詢符合條件的學(xué)生信息。5.排序功能:以英語課程的分數(shù)為依據(jù)對學(xué)習(xí)信息進行排序。6.退出菜單。1.5 任務(wù)計劃1.程序可以根據(jù)使用者的合法操作實現(xiàn)已羅列的功能3.在輸入不符合文字時,程序會做出提示4.若想退出 查詢,刪除,修改, 功能時,若想不進行操作退出功能,需要按回車鍵退出。5.若插入已存在相同學(xué)號的信息后再次插入,會進行提示,是否替換,并輸出原信息和要插入的信息第2章 概要設(shè)計2.1 總體設(shè)計總體結(jié)構(gòu)采取模塊化方式
7、進行程序設(shè)計,要求程序的功能設(shè)計、數(shù)據(jù)結(jié)構(gòu)設(shè)計及整體結(jié)構(gòu)設(shè)計合理。也可根據(jù)自己對題目的理解增加新的功能模塊。系統(tǒng)以菜單界面方式工作,運行界面友好,演示程序以用戶和計算機的對話方式進行。2.2 數(shù)據(jù)類型設(shè)計(或數(shù)據(jù)結(jié)構(gòu)設(shè)計)1.數(shù)據(jù)以鏈表的形式儲存2.存在一個結(jié)構(gòu)體struct studentlong num;char name15;int age;char sex3;char dizhi20;char phone11;struct student *next;2.3 接口設(shè)計表2.1:函數(shù)列表函數(shù)名函數(shù)格式 /即函數(shù)首部函數(shù)功能Voidshow_menu(); void顯示菜單 void me
8、nu();void執(zhí)行菜單voidcreat_stu(); void建立鏈表voidinsert_stu(); void學(xué)生信息錄入Voidprint_stu(); void學(xué)生信息瀏覽 voidsearch_num();void以學(xué)號方式查找voidsearch_name(); void以姓名方式查找voidarrage_stu(); void排序Voiddel_stu(); void刪除學(xué)生信息 void revise_stu();void修改學(xué)生信息void save(); void保存信息2.4 運行界面設(shè)計1.主菜單界面2.錄入界面3.瀏覽界面 4.查詢界面5.刪除界面6.插入界面7
9、.修改界面第3章 詳細設(shè)計3.1 輸入模塊設(shè)計struct student *creat()int n;struct student *head;struct student *p1,*p2;n=0;p1=p2=(struct student *)malloc(len);scanf("%dt%dt%st%st%st%st",&p1->num,&p1->age,p1->name,p1->sex,p1->dizhi,p1->phone);head=NULL;while(p1->num!=0)n=n+1;if(n=1)he
10、ad=p1;else p2->next=p1;p2=p1;p1=(struct student *)malloc(len);scanf("%dt%dt%st%st%st%st",&p1->num,&p1->age,p1->name,p1->sex,p1->dizhi,p1->phone);p2->next=NULL;return(head);3.2 輸出模塊設(shè)計struct student *read()struct student *head=NULL;struct student *p=NULL;struc
11、t student *t=NULL;int a;if(fp=fopen("keshe","r")=NULL)printf("cannot open this filen");exit(0);while(1)t=(struct student *)malloc(len);a=fscanf(fp,"%dt%dt%st%st%st%st",&t->num,&t->age,t->name,t->sex,t->dizhi,t->phone); if(a=0|a=-1)fcl
12、ose(fp);return head; t->next=NULL; if(p=NULL) p=t; head=t;elsep->next=t;p=p->next;p->next=NULL;3.3 查找模塊設(shè)計void findList_num(struct student*head,long search_num)struct student *p;p=head;while(p!=NULL)&&(p->num!=search_num) p=p->next; if(p!=NULL)printf("%dt%dt%st%st%st%st
13、n",p->num,p->age,p->name,p->sex,p->dizhi,p->phone); else printf("沒有該學(xué)生信息!n");void findList_name(struct student *head,char *search_name)struct student *p;int cmp1=0,cmp=0;p=head;while(p!=NULL) if(strcmp(p->name,search_name)!=0) p=p->next; cmp+;elseprintf("%
14、dt%dt%st%st%st%stn",p->num,p->age,p->name,p->sex,p->dizhi,p->phone); p=p->next; cmp1=1; if(cmp!=0&&cmp1=0)printf("沒有該學(xué)生信息!n");3.4 排序模塊設(shè)計void paixu(struct student *head)struct student *p,*f,*t;char ch100;int i;t=f=p=head;for(p=head;p->next!=NULL;p=p->
15、next)for(t=p,f=t->next;f!=NULL;f=f->next)if(t->num>f->num) i=t->num; t->num=f->num; f->num=i; i=t->age; t->age=f->num; f->age=i; strcpy(ch,t->name); strcpy(t->name,f->name); strcpy(f->name,ch); strcpy(ch,t->sex); strcpy(t->sex,f->sex); strc
16、py(f->sex,ch); strcpy(ch,t->dizhi); strcpy(t->dizhi,f->dizhi); strcpy(f->dizhi,ch); strcpy(ch,t->phone); strcpy(t->phone,f->phone); strcpy(f->phone,ch); 3.5 保存及讀取模塊設(shè)計void save(struct student *head)struct student *p;if(fp=fopen("keshe","w")=NULL)printf(&
17、quot;cannot open this filen");exit(0);p=head;while(p!=NULL)fprintf(fp,"%dn",p->num);fprintf(fp,"%dn",p->age);fprintf(fp,"%sn",p->name);fprintf(fp,"%sn",p->sex);fprintf(fp,"%sn",p->dizhi);fprintf(fp,"%sn",p->phone); p=
18、p->next;fclose(fp);struct student *read()struct student *head=NULL;struct student *p=NULL;struct student *t=NULL;int a;if(fp=fopen("keshe","r")=NULL)printf("cannot open this filen");exit(0);while(1)t=(struct student *)malloc(len);a=fscanf(fp,"%dt%dt%st%st%st%st&
19、quot;,&t->num,&t->age,t->name,t->sex,t->dizhi,t->phone); if(a=0|a=-1)fclose(fp);return head; t->next=NULL; if(p=NULL) p=t; head=t;elsep->next=t;p=p->next;p->next=NULL;第4章 測試分析4.1 測試程序執(zhí)行情況4.2 出現(xiàn)的問題和解決的方法錄入時就錄入了一個學(xué)生的信息,然后刪完插入時沒法插入了。然后重新錄入幾個學(xué)生信息重新調(diào)試的程序。第5章 課程設(shè)計總結(jié) 在
20、做這次程序設(shè)計時遇到了很多問題,一開始覺得無從下手。覺得這次老師給我們安排課程設(shè)計是為了讓我們鞏固這半年所學(xué)的知識,也使我學(xué)到了很多平時所忽略的小問題,最重要的是,它磨礪了我們,能讓我們在大學(xué)的下一個階段能更好的學(xué)好這門課。附錄:程序代碼#include<stdio.h>#include<malloc.h>#include<stdlib.h>#include<string.h>#define len sizeof(struct student)FILE *fp;struct studentlong num;char name15;int age;
21、char sex3;char dizhi20;char phone11;struct student *next;void menu()printf("=學(xué)生信息管理系統(tǒng)=nn");printf(" 1、錄入學(xué)生信息n");printf(" 2、瀏覽學(xué)生信息n");printf(" 3、查詢學(xué)生信息n");printf(" 4、刪除學(xué)生信息n");printf(" 5、插入學(xué)生信息n");printf(" 6、修改學(xué)生信息n");printf("
22、 7、排序?qū)W生信息n");printf(" 8、退出管理系統(tǒng)n");printf("=n");struct student *creat()int n;struct student *head;struct student *p1,*p2;n=0;p1=p2=(struct student *)malloc(len);scanf("%dt%dt%st%st%st%st",&p1->num,&p1->age,p1->name,p1->sex,p1->dizhi,p1->pho
23、ne);head=NULL;while(p1->num!=0)n=n+1;if(n=1)head=p1;else p2->next=p1;p2=p1;p1=(struct student *)malloc(len);scanf("%dt%dt%st%st%st%st",&p1->num,&p1->age,p1->name,p1->sex,p1->dizhi,p1->phone);p2->next=NULL;return(head);void insert(struct student *head)int
24、search_num;struct student *p,*q,*s;p=head;printf("在哪個學(xué)生前插入 請輸入學(xué)號: n");scanf("%d",&search_num);while(p!=NULL)&&(p->num!=search_num)q=p;p=p->next;s=(struct student *)malloc(len);q->next=s;system("cls");printf("請輸入學(xué)生信息:n");printf("numt a
25、get namet sext dizhit phonetn");scanf("%dt%dt%st%st%st%st",&s->num,&s->age,s->name,s->sex,s->dizhi,s->phone);s->next=p;void printList(struct student *head)struct student *p;p=head;if(head=NULL)printf("沒有學(xué)生信息n");elsedoprintf("%dt%dt%st%st%st%
26、stn",p->num,p->age,p->name,p->sex,p->dizhi,p->phone);p=p->next;while(p!=NULL);void findList_num(struct student*head,long search_num)struct student *p;p=head;while(p!=NULL)&&(p->num!=search_num) p=p->next; if(p!=NULL)printf("%dt%dt%st%st%st%stn",p->
27、;num,p->age,p->name,p->sex,p->dizhi,p->phone); else printf("沒有該學(xué)生信息!n");void findList_name(struct student *head,char *search_name)struct student *p;int cmp1=0,cmp=0;p=head;while(p!=NULL) if(strcmp(p->name,search_name)!=0) p=p->next; cmp+;elseprintf("%dt%dt%st%st%s
28、t%stn",p->num,p->age,p->name,p->sex,p->dizhi,p->phone); p=p->next; cmp1=1; if(cmp!=0&&cmp1=0)printf("沒有該學(xué)生信息!n");int xiugai(struct student *p1,long xiu_num)struct student *p2;p2=p1;while(p2!=NULL)&&(p2->num!=xiu_num) p2=p2->next;if(p2!=NULL)s
29、canf("%dt%dt%st%st%st%st",&p2->num,&p2->age,p2->name,p2->sex,p2->dizhi,p2->phone);return 1;elseprintf("沒有該學(xué)生信息!n");return 0;struct student *delList(struct student *head,long del_num)struct student *p,*q;p=head;q=head;while(p &&(p->num != del_n
30、um)q=p;p=p->next;if(p=NULL) printf("無此學(xué)號!n");elseif(p=head)head=p->next;free(p);elseq->next=p->next;free(p);return head;void paixu(struct student *head)struct student *p,*f,*t;char ch100;int i;t=f=p=head;for(p=head;p->next!=NULL;p=p->next)for(t=p,f=t->next;f!=NULL;f=f-
31、>next)if(t->num>f->num) i=t->num; t->num=f->num; f->num=i; i=t->age; t->age=f->num; f->age=i; strcpy(ch,t->name); strcpy(t->name,f->name); strcpy(f->name,ch); strcpy(ch,t->sex); strcpy(t->sex,f->sex); strcpy(f->sex,ch); strcpy(ch,t->dizh
32、i); strcpy(t->dizhi,f->dizhi); strcpy(f->dizhi,ch); strcpy(ch,t->phone); strcpy(t->phone,f->phone); strcpy(f->phone,ch); void save(struct student *head)struct student *p;if(fp=fopen("keshe","w")=NULL)printf("cannot open this filen");exit(0);p=head;w
33、hile(p!=NULL)fprintf(fp,"%dn",p->num);fprintf(fp,"%dn",p->age);fprintf(fp,"%sn",p->name);fprintf(fp,"%sn",p->sex);fprintf(fp,"%sn",p->dizhi);fprintf(fp,"%sn",p->phone); p=p->next;fclose(fp);struct student *read()struct
34、student *head=NULL;struct student *p=NULL;struct student *t=NULL;int a;if(fp=fopen("keshe","r")=NULL)printf("cannot open this filen");exit(0);while(1)t=(struct student *)malloc(len);a=fscanf(fp,"%dt%dt%st%st%st%st",&t->num,&t->age,t->name,t-&g
35、t;sex,t->dizhi,t->phone); if(a=0|a=-1)fclose(fp);return head; t->next=NULL; if(p=NULL) p=t; head=t;elsep->next=t;p=p->next;p->next=NULL;int main()int code=0;struct student *pt=NULL; while(code!=8) menu(); printf("請輸入上述序號進行操作:n"); scanf("%d",&code); system(&q
36、uot;cls"); switch(code) case 1: system("cls"); printf("每個學(xué)生的信息之間用Tab鍵分隔n"); printf("=錄入學(xué)生信息=n"); printf("-n"); printf("numt aget namet sext dizhit phonet"); pt=creat(); save(pt); system("cls"); printf("=錄入學(xué)生信息=n"); printf(&qu
37、ot;-n"); printf("*錄入學(xué)生信息成功*!n"); printf("按回車鍵返回主菜單n"); getchar(); getchar(); system("cls"); ;break; case 2: system("cls"); printf("=學(xué)生信息表=n"); printf("-n"); printf("numt aget namet sext dizhit phonetn"); pt=read(); printList(
38、pt);printf("=n"); printf("-n"); printf("n按回車鍵返回主菜單n"); getchar(); getchar(); system("cls"); ;break;case 3: int search=0; system("cls"); printf("=查詢學(xué)生信息=n"); printf("-n"); while(search!=3) printf(" 1、按學(xué)號查詢n 2、按姓名查詢n 3、退出查詢n&qu
39、ot;); scanf("%d",&search); switch(search) case 1:long search_num;system("cls");printf("請輸入學(xué)生學(xué)號n");scanf("%d",&search_num);/wzyscanf("cls");printf("=查詢結(jié)果=n");printf("-n");printf("numt aget namet sext dizhit phonetn&quo
40、t;);findList_num(read(),search_num);printf("=n");printf("-n");printf("n按回車鍵返回查詢菜單n");getchar();getchar();system("cls");break; case 2:char search_name15;system("cls");printf("請輸入學(xué)生姓名n");scanf("%s",search_name);system("cls"
41、;);printf("=學(xué)生信息表=n");printf("-n");printf("numt aget namet sext dizhit phonetn");findList_name(read(),search_name);printf("=n");printf("-n");printf("n按回車鍵返回查詢菜單n");getchar();getchar();system("cls");break;case 3:printf("=n&quo
42、t;);printf("-n");printf("n按回車鍵返回主菜單n");getchar();getchar();system("cls");break; break;case 4:long del_num;system("cls");printf("=刪除學(xué)生信息=n");printf("-n");printf("請輸入要刪除學(xué)生信息的學(xué)號:n");scanf("%d",&del_num);system("cls");pt=delList(read(),del_num);save(pt);printf("=刪除結(jié)果=n");printf("-n");printf("學(xué)號為%d的學(xué)生信息成功刪除n",del_num);printf("n按回車鍵返回主菜單n");getchar();getchar();system("cls");break;case 5:system(&quo
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度子女撫養(yǎng)權(quán)變更案件調(diào)解服務(wù)協(xié)議
- 2025至2030年中國耐曬黃數(shù)據(jù)監(jiān)測研究報告
- 2025至2030年中國羊皮靴數(shù)據(jù)監(jiān)測研究報告
- 二零二五年度家政服務(wù)人員勞動合同與意外傷害賠償協(xié)議
- 二零二五年度醫(yī)療健康企業(yè)自愿退股及醫(yī)療服務(wù)協(xié)議書
- 二零二五年度污水治理項目環(huán)境影響評估分包合同
- 二零二五年度智慧社區(qū)商品房屋租賃服務(wù)協(xié)議
- 農(nóng)村宅基地房屋贈與協(xié)議書(2025年度)范本及案例分析
- 2025年度贍養(yǎng)老人個人所得稅扣除協(xié)議規(guī)范
- 疫情供餐合同范本
- 安徽省歷年中考語文現(xiàn)代文閱讀之非連續(xù)性文本閱讀6篇(截至2024年)
- GB/T 23694-2024風(fēng)險管理術(shù)語
- 2025年北京青年政治學(xué)院高職單招高職單招英語2016-2024年參考題庫含答案解析
- 《典型的光器件AWG》課件
- 出血熱知識培訓(xùn)課件
- 廣東省汕頭市潮南區(qū)2024-2025學(xué)年高一上學(xué)期期末教學(xué)質(zhì)量監(jiān)測英語試卷(無答案)
- 永輝超市存貨管理問題及優(yōu)化建議9700字
- 售后服務(wù)組織結(jié)構(gòu)及崗位職責(zé)
- 2024年度工業(yè)自動化設(shè)備維護保養(yǎng)及上門維修合同3篇
- 2025年公司總經(jīng)理年終總結(jié)工作報告
- 安徽省“江淮十?!?024屆高考化學(xué)一模試卷含解析
評論
0/150
提交評論