C語言寫的學生成績管理系統鏈表_第1頁
C語言寫的學生成績管理系統鏈表_第2頁
C語言寫的學生成績管理系統鏈表_第3頁
C語言寫的學生成績管理系統鏈表_第4頁
C語言寫的學生成績管理系統鏈表_第5頁
已閱讀5頁,還剩3頁未讀 繼續免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、器 Sr#include<stdio.h>#include<string.h>#include<stdlib.h>struct studlong num;char name20;float sx;float dx;float ts;float dl;float cx;float zf;float pj;struct studcodestruct stud student;struct studcode *next;void menu();void input(struct studcode *);void output(struct studcode *);

2、void binsearch(struct studcode *);void insert(struct studcode *);void delet(struct studcode *);void good(struct studcode *);void fail(struct studcode *);void sort(struct studcode *);void back();void main()char choose;int flag=1;struct studcode *head;head=NULL;printf("請先錄入學生成績信息n");printf(&

3、quot;輸入學生學號姓名高數、英語讀寫、英語聽說、計算機導論和程序設計的成績 n");input(&head);while (flag)(system("cls");menu();printf("請選擇:");getchar();choose=getchar();switch(choose) (case '1':output(head);back();break;case '2':binsearch(head);back();break;case '3':insert(&head

4、);output(head);back();break;case '4':delet(&head);output(head);back();break;case '5':good(head);back();break;case '6':fail(head);back();break;case '7':sort(head);output(head);back();break;case '0':flag=0;printf("n* The End! *n");printf("n #感

5、謝使用,歡送再次登錄,拜拜! #'n");尚品break;default: printf("n Wrong Selection !(選擇錯誤,請重選 )n"); back(); void menu()printf(" n學生成績統計與分析系統n");printf(" n菜 單 nn");printf(" n1.顯布所后學生的信息n");printf(" n2.查找某學號的學生信息n");printf(" n3.插入某學生的信息n");printf("

6、; n4.刪除某學號學生的信息n");printf(" n5.統計各門課程成績在 90分以上學生所占百分比printf(" n6.統計各門課程成績在 60分以下學生所占百分比printf(" n7.按總分降序排序,依上下排知名次n");printf(" n0.退出 nn");n");n");void back()int x;printf("n");doprintf("按1返回菜單界面:");scanf("%d",&x);while(x!=

7、1);void input(struct studcode *headp)struct studcode *p;while(1)p=(struct studcode *)malloc(sizeof(struct studcode);scanf("%ld",&p->student.num);if(p->student.num=0) break;"才j (PH d-F- - = - - - - - - * - -scanf("%s%f%f%f%f%f",&p->,&p->stu

8、dent.sx,&p->student.dx,&p->student.ts, &p->student.dl,&p->student.cx);p->student.zf=p->student.sx+p->student.dx+p->student.ts+p->student.dl+p->student.cx;p->student.pj=p->student.zf/5;p->next=*headp;*headp=p;void output(struct studcode *head)str

9、uct studcode *p;p=head;printf("學號t姓名t高數t讀寫t聽說t導論t程序t總分t平均分n");while(p!=NULL)printf("%-ldt%-4st%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn",p->student.n um,p->,p->student.sx,p->student.dx,p->student.ts,p->student.dl,p->student.cx,p->s tude

10、nt.zf,p->student.pj);p=p->next;printf("n");void binsearch(struct studcode *head)struct studcode *p;int k=1;long x;p=head;printf("請輸入需要查找的學生的學號:");scanf("%ld",&x);printf("n");while(p!=NULL)if(p->student.num=x)printf("該學生信息如下:n");printf(&q

11、uot;學號t姓名t高數t讀寫t聽說t導論t程序t總分t平均分n");printf("%-ldt%-4st%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn",p->student.num,p"一 才j (PH d-F- - = = - - - - - * " ->,p->student.sx,p->student.dx,p->student.ts,p->student.dl,p->student.cx,p->stude nt

12、.zf,p->student.pj);k=0;break;p=p->next; if(k) printf("沒有此學生的信息n"); void insert(struct studcode *headp)struct studcode *p;p=(struct studcode *)malloc(sizeof (struct studcode);printf("請輸入你想插入的學生的信息n");scanf("%ld%s%f%f%f%f%f",&p->student.num,&p->student

13、.name,&p->student.sx,&p->stude nt.dx,&p->student.ts,&p->student.dl,&p->student.cx);p->student.zf=p->student.sx+p->student.dx+p->student.ts+p->student.dl+p->student.cx;p->student.pj=p->student.zf/5;p->next=*headp;*headp=p;printf("* 插入

14、成功 *n"); void delet(struct studcode *headp)struct studcode *p,*last;long x;p=*headp;printf("請輸入你要刪除的學生的學號:");scanf("%ld",&x);while(p->student.num!=x&&p->next!=NULL) last=p;p=p->next;if(p->student.num=x)if(p=*headp)器 Sr*headp=p->next;elselast->ne

15、xt=p->next;free(p);printf("n* 刪除成功 *n");)else printf("n*刪除失敗,無該學生信息 *n"); ) void good(struct studcode *head)(struct studcode *p;int x1,x2,x3,x4,x5,k;float y1,y2,y3,y4,y5;x1=x2=x3=x4=x5=k=0;p=head;while(p!=NULL)k+;if(p->student.sx>=90) x1+;if(p->student.dx>=90) x2+;

16、if(p->student.ts>=90) x3+;if(p->student.dl>=90) x4+;if(p->student.cx>=90) x5+;p=p->next;)y1=(float)x1/k;y2=(float)x2/k;y3=(float)x3/k;y4=(float)x4/k;y5=(float)x5/k;printf("高數t讀寫t聽說t導論t程序n");printf("%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn",y1,y2,y3,y4,y5);) void f

17、ail(struct studcode *head) struct studcode *p;器 Srint x1,x2,x3,x4,x5,k;float y1,y2,y3,y4,y5;x1=x2=x3=x4=x5=k=0;p=head;while(p!=NULL)k+;if(p->student.sx<60) x1+;if(p->student.dx<60) x2+;if(p->student.ts<60) x3+;if(p->student.dl<60) x4+;if(p->student.cx<60) x5+;p=p->next;y1=(float)x1/k;y2=(float)x2/k;y3=(float)x3/k;y4=(float)x4/k;y5=(float)x5/k;printf("高數t讀寫t聽說t導論t程序n");printf("%-0.2ft%-0.2ft%-0.2ft%-0.2ft%-0.2fn",y1,y2,y3,y4,y5); void sort(struct studcode *head)struct stud temp;int i,j,n;struct studcode *p,*

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論