歡迎來到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

11計本(3)班《c++課程設(shè)計報告》學(xué)生信息管理系統(tǒng)程張磊

  • 資源ID:135064804       資源大?。?span id="nhzg6ur" class="font-tahoma">165.50KB        全文頁數(shù):12頁
  • 資源格式: DOC        下載積分:10積分
快捷下載 游客一鍵下載
會員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要10積分
郵箱/手機:
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機號,方便查詢和重復(fù)下載(系統(tǒng)自動生成)
支付方式: 支付寶    微信支付   
驗證碼:   換一換

 
賬號:
密碼:
驗證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會被瀏覽器默認(rèn)打開,此種情況可以點擊瀏覽器菜單,保存網(wǎng)頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無水印,預(yù)覽文檔經(jīng)過壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒有明確說明有答案則都視為沒有答案,請知曉。

11計本(3)班《c++課程設(shè)計報告》學(xué)生信息管理系統(tǒng)程張磊

巢湖學(xué)院計算機與信息工程學(xué)院 課程名稱 C+課程設(shè)計 課題名稱 學(xué)生信息管理系統(tǒng) 專業(yè) 計算機科學(xué)與技術(shù) 班級 11級計本3班 學(xué)號 11011169 姓名 程張磊 聯(lián)系方式 18226926353 指導(dǎo)教師 許榮泉 目錄一、 系統(tǒng)的設(shè)計需求-2二、 系統(tǒng)的功能模塊劃分-2三、 系統(tǒng)的整體設(shè)計-2四、 調(diào)試分析-6五、 總結(jié)-7六、 附件:代碼-7一、系統(tǒng)的設(shè)計需求1、整個系統(tǒng)均用C語言實現(xiàn);2、利用指針、鏈表來實現(xiàn)學(xué)生成績的數(shù)據(jù)結(jié)構(gòu)設(shè)計;3、系統(tǒng)具有輸入、顯示、刪除、排序、退出基本功能;4、系統(tǒng)的各個功能模塊都用函數(shù)的形式來實現(xiàn);5、可以將學(xué)生信息全部顯示出來出來。二、系統(tǒng)的功能模塊劃分每一條記錄包括一個學(xué)生的姓名、成績。同時1、輸入功能:一次可以完成一個學(xué)生成績記錄的輸入。2、顯示功能:完成全部學(xué)生記錄的顯示。3、刪除功能:對指定學(xué)生的成績進行刪除。4、排序功能:按學(xué)生從大到小進行排序。5、修改功能:對學(xué)生的成績進行修改。三、系統(tǒng)的整體設(shè)計1).數(shù)據(jù)結(jié)構(gòu)設(shè)計:A、輸入功能的設(shè)計:void insert_func(void) char s_temp4;ptr=(struct student *) malloc(sizeof(struct student);printf(" Student name : ");gets(ptr->name);/ gets從標(biāo)準(zhǔn)輸入設(shè)備讀取字符串/printf(" Student score: ");gets(s_temp);ptr->score = atoi(s_temp);/把字符串轉(zhuǎn)化為 整數(shù)/B、刪除功能的設(shè)計:void delete_func(void)/現(xiàn)在進入刪除操作/char del_name20;printf(" Delete student name: ");gets(del_name);prev = head;current = head->next;while (current != NULL) && (strcmp(current->name , del_name)!=0)/用到了strcmp 比較字符串prev = current;current = current->next;if (current != NULL)prev->next = current->next;free(current);/釋放當(dāng)前位置/printf(" %s student record deletedn",del_name);/輸出被刪除的姓名/elseprintf(" Student %s not foundn",del_name);/否則此學(xué)生不存在/C、排序功能的設(shè)計:void sort_func(void) /插入數(shù)據(jù)/prev = head;/把頭指針?biāo)傅闹蹈督oprev/current = head->next;/把頭指針的下一個指針值付給當(dāng)前指針?biāo)傅奈恢?while (current != NULL) && (current->score > ptr->score)prev = current;current = current->next;ptr->next = current;prev->next = ptr;D、修改功能的設(shè)計:void modify_func(void)char n_temp20,s_temp4;/定義字符類型/printf(" Modify student name: ");gets(n_temp);/這樣輸入姓名current=head->next;while (current != NULL) && (strcmp(current->name , n_temp)!=0)prev = current;current = current->next;if (current != NULL)printf(" *n");printf(" Student name : %sn",current->name);printf(" Student score: %dn",current->score);printf(" *n");printf(" Please enter new score: ");gets(s_temp);current->score = atoi(s_temp);printf(" %s student record modifiedn",n_temp);/輸出被修改的成績/elseprintf(" Student %s not foundn",n_temp);/否則此學(xué)生不存在/anykey_func();E、顯示功能的設(shè)計:void display_func(void)/定義顯示/int count=0;system("cls");if(head->next = NULL)/如果頭指針?biāo)笖?shù)為空/printf(" No student recordn");/則輸出學(xué)生記錄為空/else/否則輸出學(xué)生姓名和成績/printf(" NAME SCOREn");printf(" -n");current=head->next;while(current != NULL)printf(" %-20s %3dn", current->name, current->score);count+;current=current->next;if(count % 20 = 0) getch();printf(" -n");printf(" Total %d record(s) foundn", count);2).功能模塊的具體設(shè)計整個系統(tǒng)除了主函數(shù)外,另外還有8個函數(shù),實現(xiàn)5大功能:輸入功能、顯示功能、排序功能、刪除功能、修改功能。各個函數(shù)的詳細(xì)設(shè)計說明分別如下:1、 主函數(shù) main()利用while()循環(huán)和swithch()實現(xiàn)各函數(shù)的調(diào)用,系統(tǒng)根據(jù)輸入的數(shù)字選項來調(diào)用相應(yīng)的函數(shù)。2、 輸入記錄函數(shù)getch(); insert_func();這是一個無參函數(shù),用來執(zhí)行第學(xué)生成績記錄的輸入,當(dāng)當(dāng)沒有學(xué)生紀(jì)錄時就開始進行輸入操作。算法:先聲明一個首節(jié)點head,并將head->next設(shè)為NULL。然后用 if(fptr=fopen(“slist.dat”,”r”)=NULL)對程序進行判斷如果成立則進行輸入,輸入時運用getch()函數(shù)和insert_func()主導(dǎo)來完成。 最終效果圖:3、 顯示記錄函數(shù) void display_func(void)這是一個不返回值的有參函數(shù),負(fù)責(zé)對全部學(xué)生成績記錄的輸出,不足之處就是不能對學(xué)生成績進行分頁顯示。算法: 先用if語句對頭指針的下一給位置進行判斷看是否為空如果為空則不顯示如果不為空則輸出學(xué)生姓名及成績。算法:現(xiàn)將head->next賦值給當(dāng)前位置current然后再用while對current進行定義最后輸出。 最終效果:4、 刪除記錄函數(shù)void delete_func(void)這是一個有參函數(shù),先輸入要刪除的學(xué)生記錄的 姓名,找到后顯示該學(xué)生信息,等確認(rèn)后便可進行刪除。算法:從p指向的第一個結(jié)點開始,檢查該結(jié)點中的num值是否等于輸入的要求刪除的那個姓名。如果相等就將該結(jié)點刪除,如不相等,就將p后移一個結(jié)點,再如此進行下去,直到遇到表尾為止。最終效果:5、排序函數(shù)void sort_func(void)這是一個有參函數(shù),按學(xué)生成績的大小進行排6、修改函數(shù) void modify_func(void)這是一個有參函數(shù),先輸入要修改的學(xué)生姓名找到后對其成績進行修改。算法:先將head->next賦值給當(dāng)前位置current然后用while函數(shù)對其進行定義然后檢查該節(jié)點中的姓名是不是p要找的如果相等就修改,如不相等,就將current >next賦值給current在于p節(jié)點比較直到遇到表尾為止。四、調(diào)試分析(1)剛開始沒有那個初始化函數(shù),程序運行后,沒有輸入任何數(shù)據(jù)就試得去執(zhí)行顯示功能,結(jié)果顯示的是一些亂碼!加入初始化函數(shù)后,這種現(xiàn)象也隨之消失。(2)剛開始執(zhí)行輸入函數(shù),輸入十個學(xué)生的成績,輸完后執(zhí)行顯示功能,學(xué)生成績記錄是按輸入時的順序顯示的,試著在其中增加一些語句,希望能把學(xué)號按從大到小的順序顯示,但暫時沒有成功,但最后還是按從大到小的順序輸出了。(3)在輸入函數(shù)中設(shè)了一個無限循環(huán),可以輸入無數(shù)個學(xué)生的成績信息,但最后失敗了只能一個一個輸入。(4)輸入太多個學(xué)生的成績時,屏幕顯示不能控制為一頁一頁顯示,所以為了方便起見,不要輸入太多記錄,十七左右為最佳。五、 總結(jié)經(jīng)過C語言課程設(shè)計,感覺自己收獲不少!這次課程設(shè)計雖然花了我不少時間,但正是這些時間,讓我見識到了C語言的重要性。這個學(xué)生成績管理系統(tǒng)都是在自己知識范圍內(nèi)完成的,所以界面清晰簡單,可能不是很好看,但絕對實用!從這里我也得到一個體會,做一個程序,或者開發(fā)一個軟件,應(yīng)該著重從它的后臺制作入手,不能做出一個中看不中用的程序或者軟件。相信這次的課程設(shè)計為我以后繼續(xù)從事計算機工作打了一個小小的開頭。六、附件:代碼/* file name: slist.c */* 單向鍵結(jié)鏈表,插入、刪除使用排序 */學(xué)會對文件操作文件操作和單鏈表一起使用#include <stdio.h>#include <stdlib.h>#include <string.h>#include <conio.h>void read_func(void);void write_func(void);void insert_func(void);void sort_func(void);/ sort意思為類型/void delete_func(void);void display_func(void); /*DSFGAFSHDGSJHDF*/void modify_func(void); /*DSFGAFSHDGSJHDF*/void anykey_func(void); /*DSFGAFSHDGSJHDF*/struct studentchar name20; /*DSFGAFSHDGSJHDF*/int score;struct student *next;struct student *ptr, *head, *current, *prev;/全部聲明為全局變量int main(void)char option1;system("cls");/清屏read_func();/func意思為目前使用者定義函式的參數(shù)列的數(shù)目/while(1)printf("*n");printf(" 1.插入n");printf(" 2.刪除n");printf(" 3.顯示n");printf(" 4.修改n");printf(" 5.退出n");printf("*n");printf(" Please enter your choice (1-5).");option1=getche();printf("n");/*DSFGAFSHDGSJHDF*/switch(option1)case '1':insert_func();break;case '2':delete_func();break;case '3':display_func();break;case '4':modify_func();break;case '5':/ write_func();/寫入?yún)?shù)數(shù)目/exit(0);/這里也處理的比較好void read_func(void)FILE *fptr;/ FILE意思為歸檔/head=(struct student *) malloc(sizeof(struct student);head->next = NULL;/* 開始時,若表中不存在數(shù)據(jù),則要求輸入第一筆數(shù)據(jù) */if(fptr=fopen("slist.dat","r") = NULL)printf(" Data file not existn");/數(shù)據(jù)文件不存在/printf(" Press any key to edit first record.n");getch();/字符插入函數(shù)/insert_func();/不存在就實行插入操作elseptr=(struct student *) malloc(sizeof(struct student);while(fscanf(fptr, "%s %d", ptr->name, &ptr->score) != EOF)sort_func();ptr=(struct student *) malloc(sizeof(struct student);fclose(fptr);/關(guān)閉fptr所指的文件釋放緩沖區(qū)/void write_func(void)FILE *fptr;fptr=fopen("slist.dat","w");current=head->next;/ current意思為當(dāng)前的/while(current != NULL)fprintf(fptr, "%s %dn", current->name, current->score);current = current->next;fclose(fptr);void insert_func(void) /一插入就比較字符串(想比較很簡單) 不是等到全部插完了才比較char s_temp4;ptr=(struct student *) malloc(sizeof(struct student);printf(" Student name : ");gets(ptr->name);/ gets從標(biāo)準(zhǔn)輸入設(shè)備讀取字符串/printf(" Student score: ");gets(s_temp);ptr->score = atoi(s_temp);/把字符串轉(zhuǎn)化為 整數(shù)/sort_func();/*以分?jǐn)?shù)高低由大到小排列*/void sort_func(void) /插入數(shù)據(jù)/prev = head;/把頭指針?biāo)傅闹蹈督oprev/current = head->next;/把頭指針的下一個指針值付給當(dāng)前指針?biāo)傅奈恢?while (current != NULL) && (current->score > ptr->score)prev = current;current = current->next;ptr->next = current;prev->next = ptr;/前面是進行成績排序操作/void delete_func(void)/現(xiàn)在進入刪除操作/char del_name20;printf(" Delete student name: ");gets(del_name);prev = head;current = head->next;while (current != NULL) && (strcmp(current->name , del_name)!=0)/用到了strcmp 比較字符串prev = current;current = current->next;if (current != NULL)prev->next = current->next;free(current);/釋放當(dāng)前位置/printf(" %s student record deletedn",del_name);/輸出被刪除的姓名/elseprintf(" Student %s not foundn",del_name);/否則此學(xué)生不存在/以上為刪除操作/anykey_func();/進入修改操作/void modify_func(void)char n_temp20,s_temp4;/定義字符類型/printf(" Modify student name: ");gets(n_temp);/這樣輸入姓名current=head->next;while (current != NULL) && (strcmp(current->name , n_temp)!=0)prev = current;current = current->next;if (current != NULL)printf(" *n");printf(" Student name : %sn",current->name);printf(" Student score: %dn",current->score);printf(" *n");printf(" Please enter new score: ");gets(s_temp);current->score = atoi(s_temp);printf(" %s student record modifiedn",n_temp);/輸出被修改的成績/elseprintf(" Student %s not foundn",n_temp);/否則此學(xué)生不存在/anykey_func();/進入顯示操作/void display_func(void)/定義顯示/int count=0;system("cls");if(head->next = NULL)/如果頭指針?biāo)笖?shù)為空/printf(" No student recordn");/則輸出學(xué)生記錄為空/else/否則輸出學(xué)生姓名和成績/printf(" NAME SCOREn");printf(" -n");current=head->next;while(current != NULL)printf(" %-20s %3dn", current->name, current->score);count+;current=current->next;if(count % 20 = 0) getch();printf(" -n");printf(" Total %d record(s) foundn", count);anykey_func();void anykey_func(void)/任何鍵繼續(xù)printf(" Press any key to continue.");getch();printf("n");- 11 -

注意事項

本文(11計本(3)班《c++課程設(shè)計報告》學(xué)生信息管理系統(tǒng)程張磊)為本站會員(無***)主動上傳,裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng)(點擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因為網(wǎng)速或其他原因下載失敗請重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!