



版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、/*/*/list.h 文件#ifndef _LIST_H#define _LIST_H#define _INLINE_ static inlinestruct list_head struct list_head *next, *prev;#define LIST_HEAD_INIT(name) &(name), &(name)#define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)#define INIT_LIST_HEAD(ptr) do (ptr)->next = (ptr); (pt
2、r)->prev = (ptr); while (0)_INLINE_ void _list_add(struct list_head *add,struct list_head *prev,struct list_head *next)next->prev = add;add->next = next;add->prev = prev;prev->next = add;_INLINE_ void list_add(struct list_head *add, struct list_head *head) _list_add(add, head, head-&g
3、t;next);_INLINE_ void list_add_tail(struct list_head *add, struct list_head *head)_list_add(add, head->prev, head);_INLINE_ void _list_del(struct list_head *prev, struct list_head *next)next->prev = prev;prev->next = next;_INLINE_ void list_del(struct list_head *entry)_list_del(entry->pr
4、ev, entry->next);_INLINE_ void list_del_init(struct list_head *entry)_list_del(entry->prev, entry->next);INIT_LIST_HEAD(entry);_INLINE_ int list_empty(struct list_head *head)return head->next = head;_INLINE_ void list_splice(struct list_head *list, struct list_head *head)struct list_head
5、 *first = list->next;if (first != list) struct list_head *last = list->prev;struct list_head *at = head->next;first->prev = head;head->next = first;last->next = at;at->prev = last;#define list_entry(ptr, type, member) (type *)(char *)(ptr) - (unsigned long)(&(type *)0)->m
6、ember)#define list_for_each(pos, head) for (pos = (head)->next; pos != (head); pos = pos->next)#define list_for_each_safe(pos, pnext, head) for (pos = (head)->next, pnext = pos->next; pos != (head); pos = pnext, pnext = pos->next)#undef _INLINE_#endif/* *8 /* /* * 頭文件 head.h#ifndef _H
7、EAD_H_ #define _HEAD_H_ #include<string.h> #include"list.h" #include<stdio.h> #include<stdlib.h> #include<time.h> #define Y #define N'y''n'#define A_FLAG 'a'#define S_FLAG 's'#define T_FLAG 't'extern struct list_head stu;/exte
8、rn struct list_head tec;/科目信息 typedef struct subject_infofloat SUB_notes3;/科目成績(jī)intSUB_csscore;/科目學(xué)分charSUB_csname32;/科目名稱(chēng)structlist_head list;SUB;/學(xué)生信息typedef struct STU_infofloat STU_totalscore;intSTU_id;intSTU_age;intSTU_grade;intSTU_place;char STU_name32;char STU_psword32;SUBstructlist_head list;
9、subject3;/總分/學(xué)號(hào)/年齡/年級(jí)/名次/姓名/密碼STU;/教師信息 :typedef struct TCH_infointTCH_id;char TCH_name32;char TCH_psword32;SUB subject1;structlist_head list;TEC;/管理員信息typedef struct ADM_infochar ADM_usename8;char ADM_psword6;ADM;ADM use1;void gettime();void main_menu();void stu_login();void openf (char *filename);
10、void tec_login();void adm_login();void adm_nextmenu();void a_updt_stuinfo();void a_updt_tecinfo();void a_updt_myinfo();息void a_add_stuinfo();void a_add_tecinfo();void a_mdify_stuinfo();void a_del_info(char flag);void a_mdify_tecinfo();void a_seek_stuinfo();void a_seek_tecinfo();void show (char flag)
11、;void save (char flag,char system);void check(char flag);void commom();void a_show(char flag);/工號(hào)/姓名/密碼/獲取當(dāng)前時(shí)間/主菜單/學(xué)生登錄/判斷文件是否存在/老師登錄/管理員登錄/管理員 2 級(jí)菜單/操作學(xué)生信息/操作老師信息/ 操作管理 員自身 信/添加學(xué)生信息/添加老師信息/修改學(xué)生信息/刪除信息/修改老師信息/查找學(xué)生信息/查找老師信息/顯示信息/保存信息/驗(yàn)證密碼/公用函數(shù)集合/顯示信息void a_seek_info(char flag);void a_mdify_info(char
12、flag);void stu_nextmenu(int tmpid);void tec_nextmenu(int tmpid);void s_show_myinfo(int tmpid);void t_show_myinfo(int tmpid);void s_updt_myinfo(int tmpid);/查找信息/修改學(xué)生或老師信息/學(xué)生菜單/老師菜單/學(xué)生顯示自己信息/教師顯示自己信息/學(xué)生更新自己信息void s_select_subject(int tmpid);void t_updt_stuinfo(int tmpid);void t_updt_myinfo(int tmpid);
13、void readf();/學(xué)生選課/教授更新自己信息/教授顯示自己信息/從文件中讀取信息void stu_sort();float ave (float core3);float (*f)(float core3);int inputpsword(char *pass);void a_chpsword();#endif/*/*/入口 main 函數(shù)#include<stdio.h>#include<stdlib.h>#include<string.h>#include<time.h>#include"head.h"LIST_
14、HEAD(stu);LIST_HEAD(tec);int main()readf();system("clear");printf("ttt* *tt*n* *tt* *tt*Copyright (c) 2010, 易嵌教育 All rights reserved.nn* *tt* n* *tt* *tt*軟件名稱(chēng):學(xué)生選課管理系統(tǒng)摘 要 :nn* *tt* n* *tt* *tt*當(dāng)前版本: 1.1n作者:關(guān)仁杰n* *tt*完成日期: 2010 年 8 月 2 日 n* *tt*n");/void delay(unsinged int)sleep(2
15、);main_menu();return 0;void main_menu()int ch;char hc;system("clear");gettime();printf("ttt=學(xué)生信息管理系統(tǒng)=nn");printf("tt#n");printf("tt= 歡迎使用本系統(tǒng)a =n");printf("tt#nn");printf("tt+n");printf("tt=1.學(xué)生=n");printf("tt=2.教師=n");pr
16、intf("tt=3.管理員=n");printf("tt=4.退出=n");printf("tt+n");printf(" 請(qǐng)輸入您選擇的序號(hào):n");scanf("%d",&ch);switch(ch)case 1:printf(" 您的身份是學(xué)生!n 請(qǐng)登錄: n");gettime();openf("student.txt");check(S_FLAG);break;case 2:printf(" 您的身份是教師!n 請(qǐng)登錄: n
17、");gettime();openf("teacher.txt");check(T_FLAG);break;case 3:printf(" 您的身份是管理員!n 請(qǐng)登錄n");gettime();adm_login();break;case 4:printf("n");printf("aaa 您已經(jīng)保存相應(yīng)的數(shù)據(jù)了嗎?(y or n)n");getchar();scanf("%c",&hc);if(hc='y')|(hc='Y')printf(&
18、quot; 謝謝您使用本系統(tǒng),如有需要請(qǐng)聯(lián)系:printf(" 請(qǐng)按 Enter 鍵退出! n");getchar();getchar();exit(0);QQ: n");else if(hc='n')|(hc='N')printf(" 您還沒(méi)有保存,系統(tǒng)將為您自動(dòng)保存!n");save(S_FLAG,Y);break;default:printf(" 您的輸入有誤,請(qǐng)返回上級(jí)菜單!n");getchar();getchar();main_menu();/試讀文件,驗(yàn)證是否建立void ope
19、nf(char *filename)FILE *fp;if(fp=fopen(filename,"r")=NULL)filename=NULL;printf(" 對(duì)不起!還沒(méi)有建立相應(yīng)的信息!n 請(qǐng)于管理員聯(lián)系!n");getchar();getchar();main_menu();fclose(fp);/管理員登錄void adm_login()char psword6;FILE *fp;int i=0;if(fp=fopen("psword.txt","r")=NULL)printf(" 對(duì)不起沒(méi)有相
20、應(yīng)的信息,請(qǐng)您建立!n");printf(" 請(qǐng)輸入您的用戶(hù)名(不得多于8 個(gè)字符): n");scanf("%s",use0.ADM_usename);printf(" 請(qǐng)輸入您的密碼:n");while(pswordi=getchar()!='n'|(pswordi=getchar()!=EOF|i<6)putchar('*');i+;strcmp(use0.ADM_psword,psword);save(A_FLAG ,N);/save the infomain_menu();el
21、secheck(A_FLAG);fclose(fp);/*/*/*/管理員相關(guān)函數(shù)#ifndef _ADM_nextmenu_c#define _ADM_nextmenu_c#include<stdio.h>#include<string.h>#include<stdlib.h>#include"head.h"struct list_head *postion;void adm_nextmenu()int ch;system("clear");gettime();printf("tttt*n");p
22、rintf("nntt#n");printf("tt=1.更改學(xué)生信息=n");printf("tt=2.更改老師信息=n");printf("tt=3.更改自己信息=n");printf("tt=4.返回主菜單=n");printf("tt#nn");printf(" 請(qǐng)輸入您選擇的代號(hào):");scanf("%d",&ch);switch(ch)case 1:a_updt_stuinfo();break;case 2: a_u
23、pdt_tecinfo();break;case 3: a_updt_myinfo();break;case 4: printf(" 按 Enter 鍵返回主菜單!n");getchar();getchar();main_menu();break;default:printf("error!n");getchar();getchar();main_menu();/update infovoid a_updt_stuinfo()int ch;system("clear");gettime();printf("tttt*n&qu
24、ot;);printf("nntt#n");printf("tt=1.添加學(xué)生信息=n");printf("tt=2.刪除學(xué)生信息=n");printf("tt=3.查找學(xué)生信息=n");printf("tt=4.修改學(xué)生信息=n");printf("tt=5.返回上一級(jí)菜單=n");printf("tt#nn");printf(" 請(qǐng)輸入您選擇的代號(hào):");scanf("%d",&ch);switch(ch
25、)case 1: a_add_stuinfo();break;case 2: a_del_info(S_FLAG);break;case 3: a_seek_stuinfo();break;case 4: a_mdify_info(S_FLAG);break;case 5: save(S_FLAG,N);printf(" 按 Enter 返回上一級(jí)菜單!n");getchar();getchar();adm_nextmenu();break;default:printf("error!n");getchar();getchar();main_menu()
26、;/update infovoid a_updt_tecinfo()int ch;system("clear");gettime();printf("tttt*n");printf("nntt#n");printf("tt=1.添加老師信息=n");printf("tt=2.刪除老師信息=n");printf("tt=3.查找老師信息=n");printf("tt=4.修改老師信息=n");printf("tt=5.返回上一級(jí)菜單=n"
27、);printf("tt#nn");printf(" 請(qǐng)輸入您選擇的代號(hào):");scanf("%d",&ch);switch(ch)case 1: a_add_tecinfo();break;case 2: a_del_info(T_FLAG);break;case 3: a_seek_tecinfo();break;case 4: a_mdify_info(T_FLAG);break;case 5:save(T_FLAG ,N);printf(" 按 Enter 返回上一級(jí)菜單!n");getchar()
28、;getchar();adm_nextmenu();break;default:printf("error!n");getchar();getchar();main_menu();/change psword for admvoid a_updt_myinfo()int ch;system("clear");gettime();printf("tttt*n");printf("nntt#n");printf("tt=1.修改密碼=n");printf("tt=n");prin
29、tf("tt=n");printf("tt=2.返回上一級(jí)=n");printf("tt=3.返回主菜單=n");printf("tt#nn");printf(" 請(qǐng)輸入您選擇的代號(hào):");scanf("%d",&ch);switch(ch)case 1:a_chpsword();gettime();break;case 2:printf(" 按 Enter 鍵返回上一級(jí)菜單!n");getchar();getchar();adm_nextmenu
30、();break;case 3:printf(" 按 Enter 返回主菜單!n");getchar();getchar();main_menu();break;default:printf("error!n");getchar();getchar();main_menu();void a_add_stuinfo()gettime();STU *stud;int i = 0;int stu_nu = 0;FILE *fp=NULL;int j=0;printf(" 您要?jiǎng)?chuàng)建多少個(gè)學(xué)生的信息:n");scanf("%d&quo
31、t;,&stu_nu);while(i<stu_nu)stud=(STU*)malloc(sizeof(STU);strcpy(stud->STU_psword,"000");/ 初始密碼為000for(j=0;j<3;j+)strcpy(stud->subjecti.SUB_csname),"");(stud->subjecti).SUB_csscore=0;(stud->subjecti).SUB_notesi=0.0;printf(" 輸入第 %d 個(gè)學(xué)生的信息:n",i+1);pri
32、ntf(" 學(xué)生姓名 :n");scanf("%s",stud->STU_name);printf(" 學(xué)號(hào): n");scanf("%d",&stud->STU_id);printf(" 年齡: n");scanf("%d",&stud->STU_age);printf(" 年級(jí): n");scanf("%d",&stud->STU_grade);i+;list_add(&(st
33、ud->list),&stu);stu_sort();show(S_FLAG);void a_add_tecinfo()gettime();TEC *tech;TEC *point=NULL;int i = 0;int tech_nu = 0;FILE *fp=NULL;printf(" 您要?jiǎng)?chuàng)建多少個(gè)老師的信息:n");scanf("%d",&tech_nu);while(i<tech_nu)tech=(TEC*)malloc(sizeof(TEC);strcpy(tech->TCH_psword,"000&
34、quot;);/初始密碼為000printf(" 輸入第 %d 個(gè)老師的信息:n",i+1);printf(" 姓名 :n");scanf("%s",tech->TCH_name);printf(" 工號(hào): n");scanf("%d",&tech->TCH_id);printf(" 教師所授科目:n");scanf("%s",&tech->subject0);i+;list_add(&(tech->list
35、),&tec);show(T_FLAG);void a_seek_stuinfo()int ch;struct list_head *postion=NULL;STU *spoint;system("clear");gettime();printf("tt#n");printf("tt=1. 按學(xué)號(hào)或姓名查找=n");printf("tt=2.顯示所有學(xué)生信息=n");printf("tt=3.返回上一級(jí)菜單=n");printf("tt=4.返回主菜單=n");pr
36、intf("tt#n");printf(" 請(qǐng)輸入您選擇的序號(hào):n");scanf("%d",&ch);switch(ch)case 1 : a_seek_info(S_FLAG);break;case 2 :show(S_FLAG);break;case 3 : printf(" 按 Enter 鍵返回上一級(jí)!n");getchar();getchar();a_updt_stuinfo();break;case 4 : printf(" 按 Enter 主菜單! n");getchar
37、();getchar();main_menu();break;default : printf("error!");getchar();main_menu();void a_seek_tecinfo()int ch;system("clear");gettime();printf("tt#n");printf("tt=1. 按工號(hào)或姓名查找=n");printf("tt=2.顯示所有教師信息=n");printf("tt=3.返回上一級(jí)菜單=n");printf("
38、tt=4.返回主菜單=n");printf("tt#n");printf(" 請(qǐng)輸入您選擇的序號(hào):n");scanf("%d",&ch);switch(ch)case 1 : a_seek_info(T_FLAG);break;case 2 :show(T_FLAG);break;case 3 : printf(" 按 Enter 鍵返回上一級(jí)!n");getchar();getchar();a_updt_tecinfo();break;case 4 : printf(" 按 Enter
39、 返回主菜單!n");getchar();getchar();main_menu();break;default : printf("error!");getchar();main_menu();/ 更改管理員密碼void a_chpsword()FILE *fp;char psword6;char admusename8;/ 用戶(hù)名if(fp=fopen("psword.txt","r")=NULL)printf("sorry,there are nothing!n");getchar();getcha
40、r();a_updt_myinfo();elseprintf(" 請(qǐng)輸入您的用戶(hù)名:n");scanf("%s",admusename);printf(" 請(qǐng)輸入您的新密碼:n");scanf("%s",psword);if(!strcmp(use0.ADM_usename,admusename)strcpy(use0.ADM_psword,psword);fclose(fp);save(A_FLAG ,N);printf(" 修改成功! n");getchar();getchar();adm_
41、nextmenu();void a_seek_info(char flag)struct list_head *postion=NULL;STU *spoint;TEC *tpoint;int sid;int tid;switch(flag)case 's':printf(" 請(qǐng)輸入學(xué)生學(xué)號(hào):n");scanf("%d",&sid);printf(" 按學(xué)號(hào)顯示學(xué)生信息!n");list_for_each(postion,&stu)spoint=list_entry(postion,STU,list);
42、if(sid=spoint->STU_id)printf("tt學(xué)號(hào):%dt 姓名:%st 年齡:%dt 年級(jí):%dt 名次 :%dt總分:%f密碼 : %sn",spoint->STU_id,spoint->STU_name,spoint->STU_age,spoint->STU_grade,spoint->S TU_place,spoint->STU_totalscore,spoint->STU_psword);printf("printf("科目信息: n");tt科目一:%st科目二:%s
43、t科 目三: %stn",spoint->subject0.SUB_csname,spoint->subject1.SUB_csname,spoint->subject2.SUB_csname);printf("ntt科目一分?jǐn)?shù): %dt科目二分?jǐn)?shù):%dt 科目三分?jǐn)?shù): %dtn",spoint->subject0.SUB_notes0,spoint->subject1.SUB_notes1,spoint->subject2 .SUB_notes2);printf("ntt*_*_*n");printf(&q
44、uot;tt 總分: %f",(spoint->subject0.SUB_notes0+spoint->subject1.SUB_notes1+spoint->subject2. SUB_notes2)/3.0);break;printf(" 按 Enter 鍵返回上一級(jí)!n");getchar();getchar();adm_nextmenu();break;case 't':printf(" 請(qǐng)輸入老師工號(hào):n");scanf("%d",&tid);printf("按老
45、師工號(hào)顯示老師信息!n");list_for_each(postion,&tec)tpoint=list_entry(postion,TEC,list);if(tpoint->TCH_id=tid)printf("nntt*_*_*nn");printf("tt工號(hào)%dt姓名:%st密碼: %sn",tpoint->TCH_id,tpoint->TCH_name,tpoint->TCH_psword);printf(" 科目信息:n");printf("ntt%sn",tp
46、oint->subject0.SUB_csname);printf("ntt學(xué)分: %dn",tpoint->subject0.SUB_csscore);break;printf(" 按 Enter 鍵返回上一級(jí)!n");getchar();getchar();adm_nextmenu();break;default :printf("error!n");getchar();getchar();adm_nextmenu();void a_del_info(char flag)struct list_head *postion=NULL;STU *spoint;STU *stud;TEC *tpoint;int s;int t;int sid;int tid;char sname32;char tname32;switch(flag)system("clear");gettime();case 's':printf("tt+ 刪除學(xué)生信息!+n");printf("t
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 中西醫(yī)結(jié)合婦產(chǎn)科學(xué)知到課后答案智慧樹(shù)章節(jié)測(cè)試答案2025年春山西中醫(yī)藥大學(xué)
- 三級(jí)人力資源管理師-企業(yè)人力資源管理師(三級(jí))《理論知識(shí)》考前沖刺卷6
- 三級(jí)人力資源管理師-《企業(yè)人力資源》管理師三級(jí)(專(zhuān)業(yè)能力)考前沖刺卷5
- 英語(yǔ)(新高考Ⅰ卷01)(考試版)
- 廣東省惠州市惠東中學(xué)2017-2018學(xué)年高三5月熱身綜合練習(xí)歷史(二)
- 數(shù)據(jù)科學(xué)與大數(shù)據(jù)技術(shù)
- 高考化學(xué)二輪專(zhuān)題復(fù)習(xí)特色專(zhuān)項(xiàng)訓(xùn)練7第七題化學(xué)反應(yīng)原理的理解及應(yīng)用
- 高強(qiáng)格柵掛網(wǎng)施工方案
- 基于Modbus+TCP工業(yè)控制網(wǎng)絡(luò)入侵檢測(cè)分析方法研究
- 事業(yè)單位財(cái)務(wù)預(yù)算管理的必要性及優(yōu)化措施
- 全國(guó)高中青年數(shù)學(xué)教師優(yōu)質(zhì)課大賽一等獎(jiǎng)《導(dǎo)數(shù)在研究函數(shù)中的應(yīng)用》課件
- 礦山巖石力學(xué)教案
- 【海馬汽車(chē)企業(yè)營(yíng)運(yùn)能力問(wèn)題及解決策略(論文10000字)】
- 永安電力股份有限公司三臺(tái)縣凱河110千伏輸變電新建工程環(huán)評(píng)報(bào)告
- 口腔頜面外科基礎(chǔ)知識(shí)與基本操作-口腔頜面外科手術(shù)基本操作(口腔頜面外科課件)
- 學(xué)院(校)食堂餐飲企業(yè)承包經(jīng)營(yíng)退出管理制度
- 急危重癥護(hù)理學(xué)3
- API520-安全閥計(jì)算PART1(中文版)
- 本科畢設(shè)論文--企業(yè)vpn的接入規(guī)劃與設(shè)計(jì)
- 藥學(xué)綜合知識(shí)與技能智慧樹(shù)知到答案章節(jié)測(cè)試2023年云南農(nóng)業(yè)職業(yè)技術(shù)學(xué)院
- 當(dāng)責(zé)培訓(xùn)課件-張文隆
評(píng)論
0/150
提交評(píng)論