數據結構學生成績管理系統課程設計總結
標准答案給了
⑵ 數據結構課程設計-學生成績管理系統的設計
好像沒有數據結構的 你試試c++語言面向對象程序設計課程設計
這個網站能免費下幾個,不能版免費下的就要收權費了
本站免費計算機課程設計論文下載
本人原創計算機類課程設計免費下載,銷售計算機畢業論文
請把我的網站介紹給同學們.謝謝支持本站
ACCESS課程設計庫存管理工資管理系統 sqlserver資料庫課程設計 c++語言面向對象程序設計課程設計 vb課程設計學生成績系統
asp留言板(沒有論文) 計算機實訓計算機組裝與維護課程設計
簡單的網頁設計沒有論文 office課程設計 操作系統課程設計
另有以上沒有列出的計算機課程設計為收費材料30元一份 更多
⑶ 數據結構課程設計:學生成績管理系統(C++和C),求大神幫幫忙,求代碼
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
structSTUDENT{
floatscore[3];
longid;
charnames[20];
};
typedefstructSTUDENTstudent;//simplifythestructSTUDENT
typedefstructSTUDENT*Pstudent;
voidprint();
voidappend();
voidcourse_total();
voidstudent_total();
voidscore_sort(int(*compare)(floata,floatb));
voidnumber_sort();
voidname_sort(Pstudentnames_[30]);
voidnumber_search();
voidname_search();
voidstatistic(Pstudentscores_[30]);
voidshow(inti);
intascend(floata,floatb){
if(a>b)return1;
elsereturn0;
}
intdescend(floata,floatb){
if(a<b)return1;
elsereturn0;
}
intn;//thenumberofstudents
intflg=1;//trueprinttheresult
student*stuArray[30];//
intagain=1;//whethertocontinue
intmain(){
inti;
printf("Inputstudentnumber(n<30):");
scanf("%d",&n);
intchoice;
while(again){
print();
scanf("%d",&choice);
switch(choice){
case1:
append();
break;
case2:
course_total();//useflagtodefinewhethertoprint
break;
case3:
student_total();
break;
case4:
score_sort(descend);
if(flg){
printf(": ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(i);
}
break;
case5:
score_sort(descend);
if(flg){
printf(": ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(n-1-i);
}
break;
case6:
number_sort();
break;
case7:
name_sort(stuArray);
break;
case8:
number_search();
break;
case9:
name_search();
break;
case10:
statistic(stuArray);
break;
case0:
again=0;
printf("Endofprogram! ");
break;
default:
printf("Inputerror! ");
break;
}
}
return0;
}
voidprint(){
printf("1.Appendrecord ");
printf("2. ");
printf("3. ");
printf("4. ");
printf("5. ");
printf("6.Sortinascendingorderbynumber ");
printf("7.Sortindictionaryorderbyname ");
printf("8.Searchbynumber ");
printf("9.Searchbyname ");
printf("10.Statisticanalysis ");
printf("PleaseInputyourchoice:");
}
voidappend(){
inti;
printf("Inputstudent'sID,nameandscore: ");
for(i=0;i<n;i++){////
stuArray[i]=(student*)malloc(sizeof(student));
scanf("%ld%s",&stuArray[i]->id,stuArray[i]->names);
scanf("%f",&stuArray[i]->score[0]);
scanf("%f",&stuArray[i]->score[1]);
scanf("%f",&stuArray[i]->score[2]);
}
}
voidcourse_total(){
inti;
floatsum0=0.0,sum1=0.0,sum2=0.0;
for(i=0;i<n;i++){
sum0+=stuArray[i]->score[0];
sum1+=stuArray[i]->score[1];
sum2+=stuArray[i]->score[2];
}
if(flg){
printf("course%d:sum=%.0f,aver=%.0f ",1,sum0,sum0/n);
printf("course%d:sum=%.0f,aver=%.0f ",2,sum1,sum1/n);
printf("course%d:sum=%.0f,aver=%.0f ",3,sum2,sum2/n);
}
}
voidstudent_total(){
floattotal[30]={0.0};
inti;
for(i=0;i<n;i++){
total[i]=stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2];
}
if(flg){
for(i=0;i<n;i++)
printf("student%d:sum=%.0f,aver=%.0f ",i+1,total[i],total[i]/3);
}
}
voidscore_sort(int(*compare)(floata,floatb)){
inti,j;
floattotal[30]={0.0};
for(i=0;i<n;i++){
total[i]=stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2];
}
for(i=0;i<n;i++){
for(j=0;j<=i;j++)
//if((*compare)(stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2],stuArray[j]->score[0]+stuArray[j]->score[1]+stuArray[j]->score[2])==0){
if((*compare)(total[i],total[j])==0){//
student*tmp=(student*)malloc(sizeof(student));
memcpy(tmp,stuArray[i],sizeof(student));
memcpy(stuArray[i],stuArray[j],sizeof(student));
memcpy(stuArray[j],tmp,sizeof(student));
}//memcpy->theholethememory
}
}
voidnumber_sort(){//沒必要傳參
inti,j;
for(i=0;i<n;i++){
for(j=0;j<i;j++)
if(stuArray[i]->id<stuArray[j]->id){
student*tmp=(student*)malloc(sizeof(student));
memcpy(tmp,stuArray[i],sizeof(student));
memcpy(stuArray[i],stuArray[j],sizeof(student));
memcpy(stuArray[j],tmp,sizeof(student));
}
}
if(flg){
printf("Sortinascendingorderbynumber: ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(i);
}
}
voidname_sort(Pstudentnames_[30]){
inti,j;
for(i=0;i<n;i++){
for(j=0;j<=i;j++)
if(strcmp(names_[i]->names,names_[j]->names)<0){
student*tmp=(student*)malloc(sizeof(student));
memcpy(tmp,stuArray[i],sizeof(student));
memcpy(stuArray[i],stuArray[j],sizeof(student));
memcpy(stuArray[j],tmp,sizeof(student));
}
}
if(flg){
printf("Sortindictionaryorderbyname: ");
printf("NO Name MT EN PH SUM AVER ");
for(i=0;i<n;i++)
show(i);
}
}
voidnumber_search(){
longquery;
printf("Inputthenumberyouwanttosearch:");
scanf("%ld",&query);
inti;
score_sort(descend);//1009887
for(i=0;i<n;i++){
if(stuArray[i]->id==query)
break;
}
if(i!=n){
printf("%d ",i+1);
show(i);
}
else
printf("Notfound! ");
}
voidname_search(){
charquery[20];
score_sort(descend);
printf("Inputthenameyouwanttosearch:");
scanf("%s",query);
inti;
for(i=0;i<n;i++){
if(!strcmp(query,stuArray[i]->names)){
break;
}
}
if(i!=n){
printf("%d ",i+1);
show(i);
}
else
printf("Notfound! ");
}
voidstatistic(Pstudentscores_[30]){//apointerarraystandsforscores
floatMT[30],EN[30],PH[30];
inti;
for(i=0;i<n;i++){
MT[i]=scores_[i]->score[0];
EN[i]=scores_[i]->score[1];
PH[i]=scores_[i]->score[2];
}
intsta[6]={0};//(<60or60-70....)
for(i=0;i<n;i++){
if(MT[i]<60)
sta[0]++;
if(MT[i]==100)
sta[5]++;
if(MT[i]>=60&&MT[i]<=69)
sta[1]++;
if(MT[i]>=70&&MT[i]<=79)
sta[2]++;
if(MT[i]>=80&&MT[i]<=89)
sta[3]++;
if(MT[i]>=90&&MT[i]<=100)
sta[4]++;
}
if(flg){
printf("Forcourse%d: ",1);
printf("<60 %d %.2f%% ",sta[0],sta[0]/(float)n*100);//changentofloat
printf("60-69 %d %.2f%% ",sta[1],sta[1]/(float)n*100);
printf("70-79 %d %.2f%% ",sta[2],sta[2]/(float)n*100);
printf("80-89 %d %.2f%% ",sta[3],sta[3]/(float)n*100);
printf("90-100 %d %.2f%% ",sta[4],sta[4]/(float)n*100);
printf("100 %d %.2f%% ",sta[5],sta[5]/(float)n*100);
}
memset(sta,0,6*sizeof(int));//initializethestaarray
for(i=0;i<n;i++){
if(EN[i]<60)
sta[0]++;
if(EN[i]==100)
sta[5]++;
if(EN[i]>=60&&EN[i]<=69)
sta[1]++;
if(EN[i]>=70&&EN[i]<=79)
sta[2]++;
if(EN[i]>=80&&EN[i]<=89)
sta[3]++;
if(EN[i]>=90&&EN[i]<=100)
sta[4]++;
}
if(flg){
printf("Forcourse%d: ",2);
printf("<60 %d %.2f%% ",sta[0],sta[0]/(float)n*100);//changentofloat
printf("60-69 %d %.2f%% ",sta[1],sta[1]/(float)n*100);
printf("70-79 %d %.2f%% ",sta[2],sta[2]/(float)n*100);
printf("80-89 %d %.2f%% ",sta[3],sta[3]/(float)n*100);
printf("90-100 %d %.2f%% ",sta[4],sta[4]/(float)n*100);
printf("100 %d %.2f%% ",sta[5],sta[5]/(float)n*100);
}
memset(sta,0,6*sizeof(int));
for(i=0;i<n;i++){
if(PH[i]<60)
sta[0]++;
if(PH[i]==100)
sta[5]++;
if(PH[i]>=60&&PH[i]<=69)
sta[1]++;
if(PH[i]>=70&&PH[i]<=79)
sta[2]++;
if(PH[i]>=80&&PH[i]<=89)
sta[3]++;
if(PH[i]>=90&&PH[i]<=100)
sta[4]++;
}
if(flg){
printf("Forcourse%d: ",3);
printf("<60 %d %.2f%% ",sta[0],sta[0]/(float)n*100);//changentofloat
printf("60-69 %d %.2f%% ",sta[1],sta[1]/(float)n*100);
printf("70-79 %d %.2f%% ",sta[2],sta[2]/(float)n*100);
printf("80-89 %d %.2f%% ",sta[3],sta[3]/(float)n*100);
printf("90-100 %d %.2f%% ",sta[4],sta[4]/(float)n*100);
printf("100 %d %.2f%% ",sta[5],sta[5]/(float)n*100);
}
}
voidshow(inti){
printf("%ld %s ",stuArray[i]->id,stuArray[i]->names);//orderistheidaftersort
printf("%.0f %.0f %.0f ",stuArray[i]->score[0],stuArray[i]->score[1],stuArray[i]->score[2]);
floatsum=stuArray[i]->score[0]+stuArray[i]->score[1]+stuArray[i]->score[2];
printf("%.0f %.0f ",sum,sum/3);
}
⑷ 數據結構課程設計--學生成績管理系統C語言
一、需求分析
1. 系統菜單的主要功能
(1)輸入若干條記錄
(2)查找並修改記錄
(3)查找並刪除記錄
(4)成績排序
(5)查找並顯示一條記錄
(6)將數據載入內存中
(7)將所有數據寫入文件中
(0)退出程序
2. 功能分析
功能1為輸入一條記錄到結構體中去。
功能2、3和5演算法相似,都是先查找成績,2、3在此基礎上再對查找出的信息進行操作。因為學生姓名定義成了字元數組的形式,因此在運用選擇法進行排序的時候,要用到strcmp,strcpy等函數
功能4為成績排序,可按學生學號排序或某單科成績或總分排序,並輸出相關的學生信息等。
功能6和7是對文件的操作,提前准備好數據。
二、總體設計
「學生成績管理系統」包括:成績錄入、修改、刪除、成績統計和信息保存、載入這幾個模塊。
1、 主函數 main()
利用無限次循環while(1)和swithch()實現各函數的調用,系統根據輸入的數字選項來調用相應的函數。
2、 菜單選擇函數showmenu ();
這是一個無參函數,主要實現「功能選擇」的界面,在這個界面里有顯示系統的各項功能選單,根據每個功能前面的序號進行選擇。等執行完每一個函數功能後,按任一鍵回到主界面也要通過這個函數來實現!3、 輸入記錄函數addstudent (stu *s) 這是一個帶參函數,用來執行第學生成績記錄的輸入,當學生為0時停止輸入。
演算法:利用函數參數s,並將s->next設為NULL。每輸入一個數據就聲明一個新節點p,把p->next設為NULL,並且鏈接到之前列表的尾端。4、 顯示記錄函數showstudent (stu *s) 這是一個不返回值的有參函數,形參為「鏈表頭的指針」,負責對全部學生成績記錄的輸出,不足之處就是不能對學生成績進行分頁顯示。 演算法:先將p結點的指針指向第一個結點,將p結點(即第一個結點)的數據輸出。然後再將p結點的指針指向p指針的的指針(即下一結點),將p結點(即第一結點)的數據輸出。重復執行此步聚直到p指針指向NULL為止。5、 查找記錄函數findstudent (stu *s) 這是一個不返回值的有參函數,形參為「鏈表頭的指針」,實現按學號對某個學生進行查找,並顯示所查找到的記錄。 演算法:採用線性查找法往下一個節點查找。輸入所要查找的學生的學號s,設一個指針變數p,先指向第一個結點,當strcmp(p->name,s) && p != NULL時,使p後移一個結點,如果p!=NULL,輸出p所指的結點。6、 刪除記錄函數delstudent (stu *s) 這是一個有參函數,形參為「鏈表頭的指針」,先輸入要刪除的學生記錄的學號,找到後顯示該學生信息,等確認後便可按「Y」進行刪除。 演算法:從p指向的第一個結點開始,檢查該結點中的num值是否等於輸入的要求刪除的那個學號。如果相等就將該結點刪除,如不相等,就將p後移一個結點,再如此進行下去,直到遇到表尾為止。7、保存數據到文件函數savestudent (stu *s) 這是一個不返回值的有參函數,形參為「鏈表頭的指針」,可以把學生記錄保存在電腦上由自己任意命名的二進制文件。8、從文件讀數據函數loadstudent (stu *s) 這是一個不返回值的有參函數,形參為「鏈表頭的指針」,根據輸入的文件地址進行讀取。
三、程序流程圖
1)成績統計:
2)信息錄入:
3)信息修改:
4)信息刪除:
4)信息查詢:
4)信息保存:5)主函數:
四、程序調試及體會
1)程序演示:
2)程序調試:
(1)剛開始沒有那個初始化函數,程序運行後,沒有輸入任何數據就試得去執行顯示功能,結果顯示的是一些亂碼!加入初始化函數後,這種現象也隨之消失。
(2)剛開始執行輸入函數,按學號順序輸入十個學生的成績,輸完後執行顯示功能,學生成績記錄是按學號的反順序顯示的,試著在其中增加一些語句,希望能把學號按正常順序顯示,但暫時沒有成功,所以在輸入成績時只能按學號反順序輸入,最後就按學號正常順序輸出了。
(3)剛開始時,先把成績按平均分排序,再插入一個學生的成績,執行顯示功能,雖然插入的學生的成績能正常插入,但該學生的名次為0。後來,在插入成績之後,調用排序函數,把所有成績重新排序一次。
(4)在輸入函數中設了一個無限循環,可以輸入無數個學生的成績信息,當學號為0的時候則停止輸入。
(5)輸入太多個學生的成績時,屏幕顯示不能控制為一頁一頁顯示,所以為了方便起見,不要輸入太多記錄,十七左右為最佳。
(6)在沒有輸入任何信息的情況下,去執行排序功能,最後顯示有一個記錄,學號、姓名為空白,成績都為0,名次為1。
(7)在輸入選項時不能輸入字母,否則會死循環,建議不要亂輸字母。
3)心得體會:
經過一個星期的課程設計,感覺自己收獲不少!
首先是:鏈表是數據結構的基本體現,所以這個課程設計裡面主要都是用鏈表,而已要達到這樣的功能,使用鏈表相當方便,但不容易理解,所以在這方面我很了很多的時間看課本和參考課外書,使C語言的知識強化了不少。
其次,在做課程設計的過程中,發現了平時很多沒有注意到的問題,例如:返回值函數和不返回值函數兩者在主函數中的調用是不同的…………
更重要的是,這次課程設計雖然花了我不少時間,但正是這些時間,讓我見識到了要學好C語言,數據的處理是相當重要的。這個學生成績管理系統都是在自己知識范圍內完成的,所以界面清晰簡單,可能不是很好看,但絕對實用!
從這里我也得到一個體會,做一個程序,或者開發一個軟體,應該著重從它的後台製作入手,不能做出一個中看不中用的程序或者軟體。
相信這次的課程設計為我以後繼續從事計算機工作打了一個小小的開頭。
參考書目;
[1]譚浩強. C程序設計(第三版) . 北京:清華大學出版社, 2006
[2]譚浩強. C程序設計上機指導(第三版) . 北京:清華大學出版社, 2005
[3]嚴蔚敏、吳偉民. 數據結構(C語言版) . 北京:清華大學出版社, 2006
計算機科學與技術系課程設計評分表
⑸ 數據結構課程設計之學生成績管理系統
有點難
⑹ 數據結構課程設計--學生成績管理系統
可以通過網路Hi告知我
有時間可以解決你的問題
相關的要求也可以告知我
ES:\\
交易提醒:預付定金是陷阱
⑺ 學生成績管理系統 課程設計實習報告
學生成績管理(c語言版)
/*11.3.2 源程序*/
/***********xuesheng.c***********/
/******頭文件(.h)***********/
#include "stdio.h" /*I/O函數*/
#include "stdlib.h" /*其它說明*/
#include "string.h" /*字元串函數*/
#include "conio.h" /*屏幕操作函數*/
#include "mem.h" /*內存操作函數*/
#include "ctype.h" /*字元操作函數*/
#include "alloc.h" /*動態地址分配函數*/
#define N 3 /*定義常數*/
typedef struct z1 /*定義數據結構*/
{
char no[11];
char name[15];
int score[N];
float sum;
float average;
int order;
struct z1 *next;
}STUDENT;
/*以下是函數原型*/
STUDENT *init(); /*初始化函數*/
STUDENT *create(); /*創建鏈表*/
STUDENT *delete(STUDENT *h); /*刪除記錄*/
void print(STUDENT *h); /* 顯示所有記錄*/
void search(STUDENT *h); /*查找*/
void save(STUDENT *h); /*保存*/
STUDENT *load(); /*讀入記錄*/
void computer(STUDENT *h); /*計算總分和均分*/
STUDENT *insert(STUDENT *h); /*插入記錄*/
void append(); /*追加記錄*/
void (); /*復制文件*/
STUDENT *sort(STUDENT *h); /*排序*/
STUDENT *index(STUDENT *h); /*索引*/
void total(STUDENT *h); /*分類合計*/
int menu_select(); /*菜單函數*/
/******主函數開始*******/
main()
{
int i;
STUDENT *head; /*鏈表定義頭指針*/
head=init(); /*初始化鏈表*/
clrscr(); /*清屏*/
for(;;) /*無限循環*/
{
switch(menu_select()) /*調用主菜單函數,返回值整數作開關語句的條件*/
{ /*值不同,執行的函數不同,break 不能省略*/
case 0:head=init();break; /*執行初始化*/
case 1:head=create();break; /*創建鏈表*/
case 2:head=delete(head);break; /*刪除記錄*/
case 3:print(head);break; /*顯示全部記錄*/
case 4:search(head);break; /*查找記錄*/
case 5:save(head);break; /*保存文件*/
case 6:head=load(); break; /*讀文件*/
case 7:computer(head);break; /*計算總分和均分*/
case 8:head=insert(head); break; /*插入記錄*/
case 9:();break; /*復制文件*/
case 10:head=sort(head);break; /*排序*/
case 11:append();break; /*追加記錄*/
case 12:head=index(head);break; /*索引*/
case 13:total(head);break; /*分類合計*/
case 14:exit(0); /*如菜單返回值為14程序結束*/
}
}
}
/*菜單函數,返回值為整數*/
menu_select()
{
char *menu[]={"***************MENU***************", /*定義菜單字元串數組*/
" 0. init list", /*初始化*/
" 1. Enter list", /*輸入記錄*/
" 2. Delete a record from list", /*從表中刪除記錄*/
" 3. print list ", /*顯示單鏈表中所有記錄*/
" 4. Search record on name", /*按照姓名查找記錄*/
" 5. Save the file", /*將單鏈表中記錄保存到文件中*/
" 6. Load the file", /*從文件中讀入記錄*/
" 7. compute the score", /*計算所有學生的總分和均分*/
" 8. insert record to list ", /*插入記錄到表中*/
" 9. the file to new file", /*復制文件*/
" 10. sort to make new file", /*排序*/
" 11. append record to file", /*追加記錄到文件中*/
" 12. index on nomber", /*索引*/
" 13. total on nomber", /*分類合計*/
" 14. Quit"}; /*退出*/
char s[3]; /*以字元形式保存選擇號*/
int c,i; /*定義整形變數*/
gotoxy(1,25); /*移動游標*/
printf("press any key enter menu......\n"); /*壓任一鍵進入主菜單*/
getch(); /*輸入任一鍵*/
clrscr(); /*清屏幕*/
gotoxy(1,1); /*移動游標*/
textcolor(YELLOW); /*設置文本顯示顏色為黃色*/
textbackground(BLUE); /*設置背景顏色為藍色*/
gotoxy(10,2); /*移動游標*/
putch(0xc9); /*輸出左上角邊框┏*/
for(i=1;i<44;i++)
putch(0xcd); /*輸出上邊框水平線*/
putch(0xbb); /*輸出右上角邊框 ┓*/
for(i=3;i<20;i++)
{
gotoxy(10,i);putch(0xba); /*輸出左垂直線*/
gotoxy(54,i);putch(0xba);
} /*輸出右垂直線*/
gotoxy(10,20);putch(0xc8); /*輸出左上角邊框┗*/
for(i=1;i<44;i++)
putch(0xcd); /*輸出下邊框水平線*/
putch(0xbc); /*輸出右下角邊框┛*/
window(11,3,53,19); /* 製作顯示菜單的窗口,大小根據菜單條數設計*/
clrscr(); /*清屏*/
for(i=0;i<16;i++) /*輸出主菜單數組*/
{
gotoxy(10,i+1);
cprintf("%s",menu[i]);
}
textbackground(BLACK); /*設置背景顏色為黑色*/
window(1,1,80,25); /*恢復原窗口大小*/
gotoxy(10,21); /*移動游標*/
do{
printf("\n Enter you choice(0~14):"); /*在菜單窗口外顯示提示信息*/
scanf("%s",s); /*輸入選擇項*/
c=atoi(s); /*將輸入的字元串轉化為整形數*/
}while(c<0||c>14); /*選擇項不在0~14之間重輸*/
return c; /*返回選擇項,主程序根據該數調用相應的函數*/
}
STUDENT *init()
{
return NULL;
}
/*創建鏈表*/
STUDENT *create()
{
int i; int s;
STUDENT *h=NULL,*info; /* STUDENT指向結構體的指針*/
for(;;)
{
info=(STUDENT *)malloc(sizeof(STUDENT)); /*申請空間*/
if(!info) /*如果指針info為空*/
{
printf("\nout of memory"); /*輸出內存溢出*/
return NULL; /*返回空指針*/
}
inputs("enter no:",info->no,11); /*輸入學號並校驗*/
if(info->no[0]=='@') break; /*如果學號首字元為@則結束輸入*/
inputs("enter name:",info->name,15); /*輸入姓名,並進行校驗*/
printf("please input %d score \n",N); /*提示開始輸入成績*/
s=0; /*計算每個學生的總分,初值為0*/
for(i=0;i<N;i++) /*N門課程循環N次*/
{
do{
printf("score%d:",i+1); /*提示輸入第幾門課程*/
scanf("%d",&info->score[i]); /*輸入成績*/
if(info->score[i]>100||info->score[i]<0) /*確保成績在0~100之間*/
printf("bad data,repeat input\n"); /*出錯提示信息*/
}while(info->score[i]>100||info->score[i]<0);
s=s+info->score[i]; /*累加各門課程成績*/
}
info->sum=s; /*將總分保存*/
info->average=(float)s/N; /*求出平均值*/
info->order=0; /*未排序前此值為0*/
info->next=h; /*將頭結點做為新輸入結點的後繼結點*/
h=info; /*新輸入結點為新的頭結點*/
}
return(h); /*返回頭指針*/
}
/*輸入字元串,並進行長度驗證*/
inputs(char *prompt, char *s, int count)
{
char p[255];
do{
printf(prompt); /*顯示提示信息*/
scanf("%s",p); /*輸入字元串*/
if(strlen(p)>count)printf("\n too long! \n"); /*進行長度校驗,超過count值重輸入*/
}while(strlen(p)>count);
strcpy(s,p); /*將輸入的字元串拷貝到字元串s中*/
}
/*輸出鏈表中結點信息*/
void print(STUDENT *h)
{
int i=0; /* 統計記錄條數*/
STUDENT *p; /*移動指針*/
clrscr(); /*清屏*/
p=h; /*初值為頭指針*/
printf("\n\n\n****************************STUDENT********************************\n");
printf("|rec|nO | name | sc1| sc2| sc3| sum | ave |order|\n");
printf("|---|----------|---------------|----|----|----|--------|-------|-----|\n");
while(p!=NULL)
{
i++;
printf("|%3d |%-10s|%-15s|%4d|%4d|%4d| %4.2f | %4.2f | %3d |\n", i, p->no,p->name,p->score[0],p->score[1],
p->score[2],p->sum,p->average,p->order);
p=p->next;
}
printf("**********************************end*********************************\n");
}
/*刪除記錄*/
STUDENT *delete(STUDENT *h)
{
STUDENT *p,*q; /*p為查找到要刪除的結點指針,q為其前驅指針*/
char s[11]; /*存放學號*/
clrscr(); /*清屏*/
printf("please deleted no\n"); /*顯示提示信息*/
scanf("%s",s); /*輸入要刪除記錄的學號*/
q=p=h; /*給q和p賦初值頭指針*/
while(strcmp(p->no,s)&&p!=NULL) /*當記錄的學號不是要找的,或指針不為空時*/
{
q=p; /*將p指針值賦給q作為p的前驅指針*/
p=p->next; /*將p指針指向下一條記錄*/
}
if(p==NULL) /*如果p為空,說明鏈表中沒有該結點*/
printf("\nlist no %s student\n",s);
else /*p不為空,顯示找到的記錄信息*/
{
printf("*****************************have found***************************\n");
printf("|no | name | sc1| sc2| sc3| sum | ave |order|\n");
printf("|----------|---------------|----|----|----|--------|-------|-----|\n");
printf("|%-10s|%-15s|%4d|%4d|%4d| %4.2f | %4.2f | %3d |\n", p->no,
p->name,p->score[0],p->score[1],p->score[2],p->sum,
p->average,p->order);
printf("********************************end*******************************\n");
getch(); /*壓任一鍵後,開始刪除*/
if(p==h) /*如果p==h,說明被刪結點是頭結點*/
h=p->next; /*修改頭指針指向下一條記錄*/
else
q->next=p->next; /*不是頭指針,將p的後繼結點作為q的後繼結點*/
free(p); /*釋放p所指結點空間*/
printf("\n have deleted No %s student\n",s);
printf("Don't forget save\n");/*提示刪除後不要忘記保存文件*/
}
return(h); /*返回頭指針*/
}
⑻ 數據結構課程設計學生成績管理系統
定義結構體——可將成績等信息組成鏈表——排序就選擇合適的排序方法(數據結構書里有很多排序方法)——