




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第C語(yǔ)言結(jié)構(gòu)體鏈表和指針實(shí)現(xiàn)學(xué)生管理系統(tǒng)目錄一、需求分析二、整體設(shè)計(jì)三、詳細(xì)設(shè)計(jì)學(xué)生檔案管理子系統(tǒng)學(xué)生成績(jī)管理子系統(tǒng)四、代碼實(shí)現(xiàn)本文實(shí)例為大家分享了C語(yǔ)言結(jié)構(gòu)體鏈表和指針實(shí)現(xiàn)學(xué)生管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
一、需求分析
通過(guò)使用學(xué)生管理系統(tǒng),可以更加有效地對(duì)學(xué)生實(shí)現(xiàn)管理,完成對(duì)學(xué)生基本信息以及成績(jī)信息的文件保存,具有信息的增加,刪除、查詢以及修改等功能,能提供簡(jiǎn)單的數(shù)據(jù)統(tǒng)計(jì)、分析信息。
二、整體設(shè)計(jì)
學(xué)生管理系統(tǒng)主要由兩大功能模塊組成,分別是是學(xué)生檔案管理和學(xué)生成績(jī)管理兩個(gè)子系統(tǒng)。整體模塊架構(gòu)如下:
三、詳細(xì)設(shè)計(jì)
學(xué)生檔案管理子系統(tǒng)
進(jìn)入學(xué)生檔案管理子系統(tǒng),顯示該子系統(tǒng)菜單,用戶分別可選擇:錄入數(shù)據(jù)、查詢數(shù)據(jù)、修改數(shù)據(jù)、刪除數(shù)據(jù)、增加數(shù)據(jù)、統(tǒng)計(jì)分析、退出系統(tǒng)等功能。
主要實(shí)現(xiàn)函數(shù)為readin_record(),能引導(dǎo)用戶輸入學(xué)生人數(shù),依次錄入每個(gè)學(xué)生的學(xué)號(hào)、姓名、性別、出生日期、班級(jí)、生源地(具體到省、自治區(qū)和直轄市)等信息。采用結(jié)構(gòu)體Stu_record數(shù)據(jù)類型保存學(xué)生檔案信息。結(jié)構(gòu)體中含有學(xué)號(hào)、姓名、性別、出生日期、班級(jí)、生源地(具體到省、自治區(qū)和直轄市)共六項(xiàng)信息。
數(shù)據(jù)存儲(chǔ)由鏈表實(shí)現(xiàn),讀入數(shù)據(jù)完成后,按學(xué)號(hào)排序輸出,并將其保存在磁盤文件Tdata_new.txt中。
采用函數(shù)menu3_inquire_record()。設(shè)置查詢菜單,分為按學(xué)號(hào)查詢id_inquiry_record()、按姓名查詢name_inquiry_record()、按班級(jí)查詢clas_inquiry_record()、按生源地查詢syd_inquiry_record()、多條件組合查詢(班級(jí)與生源地組合查詢)clasSyd_inquiry_record()、全部顯示search()、退出查詢等功能。
采用函數(shù)modify_record()。用戶輸入修改學(xué)生的學(xué)號(hào),系統(tǒng)顯示該生信息。用switchcase語(yǔ)句設(shè)置修改選項(xiàng),選擇修改學(xué)號(hào)、姓名、性別、出生日期、班級(jí)、生源地、修改全部、保存并退出修改等。在磁盤文件Tdata_new.txt中修改相應(yīng)信息。
采用函數(shù)delete_record()。用戶輸入刪除學(xué)生的學(xué)號(hào),刪除前系統(tǒng)提示用戶再次確認(rèn)是否刪除。注意需要在學(xué)生成績(jī)管理系統(tǒng)同步刪除該生信息。
采用函數(shù)add_record()。引導(dǎo)用戶輸入增加學(xué)生的學(xué)號(hào)、姓名、性別、出生日期、班級(jí)、生源地信息,更新磁盤文件。
采用函數(shù)statistics_record()。顯示各生源地的人數(shù)以及所占百分比。
學(xué)生成績(jī)管理子系統(tǒng)
進(jìn)入學(xué)生成績(jī)管理子系統(tǒng),顯示該子系統(tǒng)菜單,用戶分別可選擇:錄入數(shù)據(jù)、查詢數(shù)據(jù)、修改數(shù)據(jù)、刪除數(shù)據(jù)、增加數(shù)據(jù)、統(tǒng)計(jì)分析、退出系統(tǒng)等功能。
主要實(shí)現(xiàn)函數(shù)為readin_score(),能引導(dǎo)用戶輸入學(xué)生人數(shù),依次錄入每個(gè)學(xué)生的學(xué)號(hào)、姓名、班級(jí)、課程成績(jī)等信息。采用結(jié)構(gòu)體Stu_score數(shù)據(jù)類型保存學(xué)生成績(jī)信息。結(jié)構(gòu)體中含有學(xué)號(hào)、姓名、班級(jí)、課程數(shù)據(jù),其中課程數(shù)據(jù)包括3門課程的成績(jī)以及平均成績(jī)。
讀入數(shù)據(jù)完成后,根據(jù)用戶輸入的3門課程成績(jī)自動(dòng)計(jì)算平均分avg,將所有數(shù)據(jù)保存在磁盤文件Tscore_new.txt中。
采用函數(shù)inquiry_score()。設(shè)置查詢菜單,分為按學(xué)號(hào)查詢id_inquiry_score()、按姓名查詢name_inquiry_score()、按班級(jí)查詢clas_inquiry_score()、退出查詢等功能。
采用函數(shù)modify_score()。用戶輸入修改學(xué)生的學(xué)號(hào),系統(tǒng)顯示該生信息。用switchcase語(yǔ)句設(shè)置修改選項(xiàng),選擇修改學(xué)號(hào)、姓名、班級(jí)、課程1成績(jī)、課程2成績(jī)、課程3成績(jī)、保存并退出修改等。在磁盤文件Tscore_new.txt中修改相應(yīng)信息。
采用函數(shù)delete_score()。用戶輸入刪除學(xué)生的學(xué)號(hào),刪除前系統(tǒng)提示用戶再次確認(rèn)是否刪除。注意需要在學(xué)生檔案管理系統(tǒng)同步刪除該生信息。
采用函數(shù)add_score()。引導(dǎo)用戶輸入增加學(xué)生的學(xué)號(hào)、姓名、班級(jí)、課程1成績(jī)、課程2成績(jī)和課程3成績(jī)。系統(tǒng)自動(dòng)計(jì)算平均分。更新磁盤文件。
采用函數(shù)menu3_statistics_score()。設(shè)置統(tǒng)計(jì)分析菜單,分為按學(xué)生分析和按課程分析。若用戶選擇按學(xué)生分析stu_statistics_score(),該函數(shù)統(tǒng)計(jì)輸出有不及格課程的學(xué)生的人數(shù)和其所占百分比。若用戶選擇按課程分析course_statistics_score(),該函數(shù)分析并輸出每門課程的最高分、最低分、平均分。
四、代碼實(shí)現(xiàn)
文件main.c
#includestdio.h
#includestring.h
#includestdlib.h
#includestdio.h
#includemalloc.h
#include"student.h"
/*函數(shù)聲明*/
voidmenu1();
voidmenu2_record();
voidmenu2_score();
intmain()
while(1)
{
intn;
menu1();
printf("請(qǐng)輸入您的選擇:\n");
scanf("%d",
switch(n)
{
case1:menu2_record();break;
case2:menu2_score();break;
case0:return0;
default:printf("您的選擇錯(cuò)誤,請(qǐng)重新輸入。\n");
}
system("pause");
system("cls");
}
return0;
}
文件student.h
#includestdio.h
#includestring.h
#includestdlib.h
#includestdio.h
#includemalloc.h
structDate
intyear;
intmonth;
intday;
enumDepart{sdjinan,sdqingdao,sdyantai,sdweifang,sdheze,sddezhou,sdbinzhou,sdweihai};
structStu_record
intid;
charname[20];
charsex[10];
structDatebirth;
intclas;
enumDepartsyd;
structStu_record*next;
structStu_record*head=NULL;
structStu_score
intid;
charname[20];
intclas;
doublecourse1;
doublecourse2;
doublecourse3;
doubleavg;
structStu_score*next;
/*函數(shù)聲明*/
structStu_record*readin_record();
voidmenu3_inquire_record();
voidid_inquiry_record(structStu_record*head);
voidname_inquiry_record(structStu_record*head);
voidclas_inquiry_record(structStu_record*head);
voidsyd_inquiry_record(structStu_record*head);
voidclasSyd_inquiry_record(structStu_record*head);
voidmodify_record(structStu_record*head);
structStu_record*delete_record(structStu_record*head);
structStu_record*add_record(structStu_record*head);
voidstatistics_record(structStu_record*head);
structStu_score*readin_score();
voidmenu3_inquire_score();
voidid_inquiry_score(structStu_score*head);
voidname_inquiry_score(structStu_score*head);
voidclas_inquiry_score(structStu_score*head);
voidmodify_score(structStu_score*head);
structStu_score*delete_score(structStu_score*head);
structStu_score*add_score(structStu_score*head);
voidmenu3_statistics_score();
voidstu_statistics_score(structStu_score*head);
voidcourse_statistics_score(structStu_score*head);
/**********公共函數(shù)**********/
structStu_record*insert(structStu_record*head,structStu_record*stu)
structStu_record*p1,*p2;
if(stu==NULL)
{
printf("請(qǐng)按照學(xué)號(hào)、姓名、性別、出生日期(如199999)、班級(jí)、生源地\n(0:山東濟(jì)南1:山東青島2:山東煙臺(tái)3:山東濰坊4:山東菏澤5:山東德州6:山東濱州7:山東威海)順序輸入\n");
stu=(structStu_record*)malloc(sizeof(structStu_record));
while(!scanf("%d%s%s%d%d%d%d%d",stu-id,stu-name,stu-sex,stu-birth.year,stu-birth.month,stu-birth.day,stu-clas,stu-syd))
{
printf("輸入信息有誤,請(qǐng)重新輸入\n");
fflush(stdin);
}
}
if(head==NULL)
{
head=stu;
head-next=NULL;
}
else
{
p1=p2=head;
while(stu-idp1-idp1-next!=NULL)
{
p2=p1;
p1=p1-next;
}
if(p2==p1)
{
if(stu-idp2-id)
{
head=stu;
stu-next=p2;
}
else
{
p2-next=stu;
stu-next=NULL;
}
}
else
{
if(stu-idp1-id)
{
p2-next=stu;
stu-next=p1;
}
else
{
p1-next=stu;
stu-next=NULL;
}
}
}
return(head);
structStu_score*sinsert(structStu_score*head,structStu_score*stu)
structStu_score*p1,*p2;
if(stu==NULL)
{
printf("請(qǐng)按照學(xué)號(hào)、姓名、班級(jí)、課程1、課程2、課程3順序輸入\n");
stu=(structStu_score*)malloc(sizeof(structStu_score));
while(!scanf("%d%s%d%lf%lf%lf",stu-id,stu-name,stu-clas,stu-course1,stu-course2,stu-course3))
{
printf("輸入信息有誤,請(qǐng)重新輸入\n");
fflush(stdin);
}
stu-avg=(stu-course1+stu-course2+stu-course3)/3.0;
}
if(head==NULL)
{
head=stu;
head-next=NULL;
}
else
{
p1=p2=head;
while(stu-idp1-idp1-next!=NULL)
{
p2=p1;
p1=p1-next;
}
if(p2==p1)
{
if(stu-idp2-id)
{
head=stu;
stu-next=p2;
}
else
{
p2-next=stu;
stu-next=NULL;
}
}
else
{
if(stu-idp1-id)
{
p2-next=stu;
stu-next=p1;
}
else
{
p1-next=stu;
stu-next=NULL;
}
}
}
return(head);
voidsearch(structStu_record*head)
structStu_record*p1;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
printf("
學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
while(p1!=NULL)
{
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
p1=p1-next;
}
printf("\n");
voidssearch(structStu_score*head)
structStu_score*p1;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
printf("
學(xué)號(hào)
姓名
班級(jí)
課程1
課程2
課程3
平均分
\n");
printf("—————————————————————————————————\n");
while(p1!=NULL)
{
printf("%-7d%-7s%-7d%-5.2lf
%-5.2lf
%-5.2lf
%-5.2lf\n",p1-id,p1-name,p1-clas,p1-course1,p1-course2,p1-course3,p1-avg);
p1=p1-next;
}
printf("\n");
/***一堆menu函數(shù)的定義***/
voidmenu1()
printf("
\n");
printf("
歡迎進(jìn)入學(xué)生管理系統(tǒng)
\n");
printf("-------------------------------------------------------\n");
printf("
\n");
printf("*************StudentInformationManagement**************\n");
printf("*
*\n");
printf("*\t\t1.進(jìn)入學(xué)生檔案管理子系統(tǒng)
*\n");
printf("*
*\n");
printf("*\t\t2.進(jìn)入學(xué)生成績(jī)管理子系統(tǒng)
*\n");
printf("*
*\n");
printf("*\t\t0.退出系統(tǒng)
*\n");
printf("*
*\n");
printf("*******************************************************\n\n");
voidmenu2_record()
while(1)
{
intn;
printf("********學(xué)生檔案管理*********\n");
printf("*
*\n");
printf("*\t1.錄入數(shù)據(jù)
*\n");
printf("*\t2.查詢數(shù)據(jù)
*\n");
printf("*\t3.修改數(shù)據(jù)
*\n");
printf("*\t4.刪除數(shù)據(jù)
*\n");
printf("*\t5.增加數(shù)據(jù)
*\n");
printf("*\t6.統(tǒng)計(jì)分析
*\n");
printf("*\t0.退出系統(tǒng)
*\n");
printf("*
*\n");
printf("*****************************\n\n");
printf("請(qǐng)輸入您的選擇:\n");
scanf("%d",
switch(n)
{
case1:
readin_record();
break;
case2:
menu3_inquire_record();
break;
case3:
modify_record(head);
break;
case4:
delete_record(head);
break;
case5:
head=add_record(head);
search(head);
break;
case6:
statistics_record(head);
break;
case0:
return;
default:
printf("您的選擇錯(cuò)誤,請(qǐng)重新輸入。\n");
}
system("pause");
system("cls");
}
voidmenu2_score()
while(1)
{
intn;
printf("********學(xué)生成績(jī)管理*********\n");
printf("*
*\n");
printf("*\t1.錄入數(shù)據(jù)
*\n");
printf("*\t2.查詢數(shù)據(jù)
*\n");
printf("*\t3.修改數(shù)據(jù)
*\n");
printf("*\t4.刪除數(shù)據(jù)
*\n");
printf("*\t5.增加數(shù)據(jù)
*\n");
printf("*\t6.統(tǒng)計(jì)分析
*\n");
printf("*\t0.退出系統(tǒng)
*\n");
printf("*
*\n");
printf("*****************************\n\n");
printf("請(qǐng)輸入您的選擇:\n");
scanf("%d",
switch(n)
{
case1:
readin_score();
break;
case2:
menu3_inquire_score();
break;
case3:
modify_score(head);
break;
case4:
delete_score(head);
break;
case5:
head=add_score(head);
ssearch(head);
break;
case6:
menu3_statistics_score();
break;
case0:
return;
default:
printf("您的選擇錯(cuò)誤,請(qǐng)重新輸入。\n");
}
system("pause");
system("cls");
}
voidmenu3_inquire_record()
while(1)
{
intn;
printf("************查詢菜單*************\n");
printf("*
*\n");
printf("*\t1.按學(xué)號(hào)查詢
*\n");
printf("*\t2.按姓名查詢
*\n");
printf("*\t3.按班級(jí)查詢
*\n");
printf("*\t4.按生源地查詢
*\n");
printf("*\t5.多條件組合查詢
*\n");
printf("*\t6.全部顯示
*\n");
printf("*\t0.退出查詢
*\n");
printf("*
*\n");
printf("*********************************\n\n");
printf("請(qǐng)輸入您的選擇:\n");
scanf("%d",
switch(n)
{
case1:
id_inquiry_record(head);
break;
case2:
name_inquiry_record(head);
break;
case3:
clas_inquiry_record(head);
break;
case4:
syd_inquiry_record(head);
break;
case5:
clasSyd_inquiry_record(head);
break;
case6:
search(head);
break;
case0:
return;
default:
printf("您的選擇錯(cuò)誤,請(qǐng)重新輸入。\n");
}
system("pause");
system("cls");
}
voidmenu3_inquire_score()
while(1)
{
intn;
printf("************查詢菜單*************\n");
printf("*
*\n");
printf("*\t1.按學(xué)號(hào)查詢
*\n");
printf("*\t2.按姓名查詢
*\n");
printf("*\t3.按班級(jí)查詢
*\n");
printf("*\t4.全部顯示
*\n");
printf("*\t0.退出查詢
*\n");
printf("*
*\n");
printf("*********************************\n\n");
printf("請(qǐng)輸入您的選擇:\n");
scanf("%d",
switch(n)
{
case1:
id_inquiry_score(head);
break;
case2:
name_inquiry_score(head);
break;
case3:
clas_inquiry_score(head);
break;
case4:
ssearch(head);
break;
case0:
return;
default:
printf("您的選擇錯(cuò)誤,請(qǐng)重新輸入。\n");
}
system("pause");
system("cls");
}
voidmenu3_statistics_score()
while(1)
{
intn;
printf("************統(tǒng)計(jì)分析*************\n");
printf("*
*\n");
printf("*\t1.按學(xué)生分析
*\n");
printf("*\t2.按課程分析
*\n");
printf("*\t0.退出統(tǒng)計(jì)分析
*\n");
printf("*
*\n");
printf("*********************************\n\n");
printf("請(qǐng)輸入您的選擇:\n");
scanf("%d",
switch(n)
{
case1:
stu_statistics_score(head);
break;
case2:
course_statistics_score(head);
break;
case0:
return;
default:
printf("您的選擇錯(cuò)誤,請(qǐng)重新輸入。\n");
}
system("pause");
system("cls");
}
/******record中函數(shù)******/
structStu_record*readin_record()
structStu_record*p2,*p1;
intn,i;
head=NULL;
FILE*w;
if((w=fopen("C:\\Desktop\\Tdata_new.txt","wb+"))==NULL)
{
printf("cannotopenfile\n");
exit(1);
}
printf("請(qǐng)輸入學(xué)生人數(shù):\n");
scanf("%d",
head=p2=p1=(structStu_record*)malloc(sizeof(structStu_record));
//開(kāi)辟內(nèi)存,用于生成鏈表
printf("學(xué)生個(gè)數(shù)為:%d個(gè),請(qǐng)按照以下順序輸入\n",n);
//對(duì)學(xué)生總數(shù)的提示,并且提示每個(gè)學(xué)生信息的輸入順序
printf("學(xué)號(hào)、姓名、性別、出生日期(如199999)、班級(jí)、生源地\n(0:山東濟(jì)南1:山東青島2:山東煙臺(tái)3:山東濰坊4:山東菏澤5:山東德州6:山東濱州7:山東威海)\n");
//每個(gè)學(xué)生信息的輸入順序
for(i=0;ii++)
{
while(!scanf("%d%s%s%d%d%d%d%d",p2-id,p2-name,p2-sex,p2-birth.year,p2-birth.month,p2-birth.day,p2-clas,p2-syd))
{
printf("輸入有誤,請(qǐng)重新輸入該學(xué)生信息\n
");
fflush(stdin);
}
if(n==1)
{
p2-next=NULL;
}
else
{
head=insert(head,p2);
p2=(structStudent*)malloc(sizeof(structStu_record));
}
}
p1=head;
while(p1!=NULL)
{
fprintf(w,"%d%s%s%d%d%d%d%d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
p1=p1-next;
}
fclose(w);
printf("成功錄入%d名學(xué)生信息,學(xué)生信息已經(jīng)按學(xué)號(hào)從小到大排列,信息如下:\n\n",n);
search(head);
returnhead;
voidid_inquiry_record(structStu_record*head)
intcho,t=1;
intnum;
structStu_record*p1;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
do
{
p1=head;
if(t==1)
{
printf("請(qǐng)輸入需要查詢的學(xué)生學(xué)號(hào):");
while(!scanf("%d",num))
{
printf("輸入有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
t=1;
}
else
{
cho=2;
}
while(p1-id!=num)
{
if(p1-next==NULL)
break;
p1=p1-next;
}
if(p1-id==num)
{
printf("
學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
}
else
{
printf("找不到該學(xué)生\n");
}
if(t==1)
{
printf("1.繼續(xù)查詢\n");
printf("2.結(jié)束查詢\n");
printf("請(qǐng)選擇:");
while(!scanf("%d",cho))
{
printf("輸入序號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
}
}
while(cho==1);
voidname_inquiry_record(structStu_record*head)
intcho,t=1;
charqname[20];
structStu_record*p1;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
do
{
p1=head;
if(t==1)
{
printf("請(qǐng)輸入需要查詢的學(xué)生姓名:");
while(!scanf("%s",qname))
{
printf("輸入有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
t=1;
}
else
{
cho=2;
}
while(strcmp(p1-name,qname)!=0)
{
if(p1-next==NULL)
break;
p1=p1-next;
}
if(strcmp(p1-name,qname)==0)
{
printf("
學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
}
else
{
printf("找不到該學(xué)生\n");
}
if(t==1)
{
printf("1.繼續(xù)查詢\n");
printf("2.結(jié)束查詢\n");
printf("請(qǐng)選擇:");
while(!scanf("%d",cho))
{
printf("輸入序號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
}
}
while(cho==1);
voidclas_inquiry_record(structStu_record*head)
intcho,t=1;
structStu_record*p1;
intqclas;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
do
{
p1=head;
if(t==1)
{
printf("請(qǐng)輸入需要查詢的學(xué)生班級(jí):");
while(!scanf("%d",qclas))
{
printf("輸入有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
t=1;
}
else
{
cho=2;
}
while(p1-clas!=qclas)
{
if(p1-next==NULL)
break;
p1=p1-next;
}
if(p1-clas==qclas)
{
printf("
學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
}
else
{
printf("找不到該學(xué)生\n");
}
if(t==1)
{
printf("1.繼續(xù)查詢\n");
printf("2.結(jié)束查詢\n");
printf("請(qǐng)選擇:");
while(!scanf("%d",cho))
{
printf("輸入序號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
}
}
while(cho==1);
voidsyd_inquiry_record(structStu_record*head)
intcho,t=1;
structStu_record*p1;
intqsyd;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
do
{
p1=head;
if(t==1)
{
printf("請(qǐng)輸入需要查詢的學(xué)生生源地:");
printf("(0:山東濟(jì)南1:山東青島2:山東煙臺(tái)3:山東濰坊4:山東菏澤5:山東德州6:山東濱州7:山東威海)\n");
while(!scanf("%d",qsyd))
{
printf("輸入有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
t=1;
}
else
{
cho=2;
}
while(p1-syd!=qsyd)
{
if(p1-next==NULL)
break;
p1=p1-next;
}
if(p1-syd==qsyd)
{
printf("
學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
}
else
{
printf("找不到該學(xué)生\n");
}
if(t==1)
{
printf("1.繼續(xù)查詢\n");
printf("2.結(jié)束查詢\n");
printf("請(qǐng)選擇:");
while(!scanf("%d",cho))
{
printf("輸入序號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
}
}
while(cho==1);
voidclasSyd_inquiry_record(structStu_record*head)
intcho,t=1;
structStu_record*p1;
intqsyd,qclas;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束查詢\n");
return;
}
p1=head;
do
{
p1=head;
if(t==1)
{
printf("請(qǐng)輸入需要查詢的學(xué)生生源地:");
while(!scanf("%d",qsyd))
{
printf("輸入有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
printf("請(qǐng)輸入需要查詢的學(xué)生班級(jí):");
while(!scanf("%d",qclas))
{
printf("輸入有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
t=1;
}
else
{
cho=2;
}
while(p1-syd!=qsyd||p1-clas!=qclas)
{
if(p1-next==NULL)
break;
p1=p1-next;
}
if(p1-syd==qsydp1-clas==qclas)
{
printf("
學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
}
else
{
printf("找不到該學(xué)生\n");
}
if(t==1)
{
printf("1.繼續(xù)查詢\n");
printf("2.結(jié)束查詢\n");
printf("請(qǐng)選擇:");
while(!scanf("%d",cho))
{
printf("輸入序號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
}
}
while(cho==1);
voidmodify_record(structStu_record*head)
structStu_record*p1,*p2;
intnum,cho,k=1,l=0;
FILE*w;
if(head==NULL)
{
printf("沒(méi)有學(xué)生信息,結(jié)束修改\n
");
system("pause");
return;
}
printf("請(qǐng)輸入需要修改的學(xué)生學(xué)號(hào):");
while(!scanf("%d",num))
{
printf("輸入學(xué)號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
do
{
p2=p1=head;
while(p1-id!=num)
{
if(p1-next==NULL)
break;
p2=p1;
p1=p1-next;
}
if(p1-id==num)
{
printf("已找到該學(xué)生,該學(xué)生的信息為:\n");
printf("生源地(0:山東濟(jì)南1:山東青島2:山東煙臺(tái)3:山東濰坊4:山東菏澤5:山東德州6:山東濱州7:山東威海)\n");
printf("學(xué)號(hào)
姓名
性別
出生日期
班級(jí)
生源地
\n");
printf("———————————————————————————\n");
printf("%-7d
%-4s
%-6s
%-4d年%-2d月%-2d日
%-6d
%-6d\n",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd);
l=0;
do
{
if(l==0)
printf("\n選擇修改的內(nèi)容\n");
else
printf("序號(hào)輸入錯(cuò)誤,請(qǐng)重新選擇\n");
l=1;
printf("
1.學(xué)號(hào)\n");
printf("
2.姓名\n");
printf("
3.性別\n");
printf("
4.出生日期\n");
printf("
5.班級(jí)\n");
printf("
6.生源地\n");
printf("
7.全部\n");
printf("請(qǐng)選擇序號(hào):");
fflush(stdin);
while(!scanf("%d",cho))
{
printf("輸入序號(hào)有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
}
while(cho7||cho
switch(cho)
{
case1:
{
printf("請(qǐng)輸入該學(xué)生改正的學(xué)號(hào)信息:");
while(!scanf("%d",p1-id))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
case2:
{
printf("請(qǐng)輸入該學(xué)生改正的姓名信息:");
while(!scanf("%s",p1-name))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
case3:
{
printf("請(qǐng)輸入該學(xué)生改正的性別信息:");
while(!scanf("%s",p1-sex))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
case4:
{
printf("請(qǐng)輸入該學(xué)生改正的出生年月信息(如輸入199999):");
while(!scanf("%d%d%d",p1-birth.year,p1-birth.month,p1-birth.day))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
case5:
{
printf("請(qǐng)輸入該學(xué)生改正的班級(jí)信息:");
while(!scanf("%d",p1-clas))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
case6:
{
printf("請(qǐng)輸入該學(xué)生改正的生源地信息:");
printf("生源地(0:山東濟(jì)南1:山東青島2:山東煙臺(tái)3:山東濰坊4:山東菏澤5:山東德州6:山東濱州7:山東威海)\n");
while(!scanf("%d",p1-syd))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
case7:
{
printf("請(qǐng)輸入該學(xué)生全部要改正的信息:");
while(!scanf("%d%s%s%d%d%d%d%d",p1-id,p1-name,p1-sex,p1-birth.year,p1-birth.month,p1-birth.day,p1-clas,p1-syd))
{
printf("輸入改正信息有誤,請(qǐng)重新輸入:");
fflush(stdin);
}
break;
}
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 《學(xué)步》教學(xué)課件
- 少兒主持教學(xué)課件
- 冰雪奇緣教學(xué)課件英語(yǔ)
- 一年級(jí)線上教學(xué)課件下載
- 【南京】2025年江蘇南京技師學(xué)院招聘工作人員19人筆試歷年典型考題及考點(diǎn)剖析附帶答案詳解
- 大班靜夜思教學(xué)課件
- 春季登山親子活動(dòng)方案
- 新教師集體備課活動(dòng)方案
- 易拉罐操活動(dòng)方案
- 春節(jié)單位活動(dòng)方案
- 2023-2024學(xué)年浙江省寧波市慈溪市四年級(jí)(下)期末數(shù)學(xué)試卷
- 2025年黑龍江、吉林、遼寧、內(nèi)蒙古高考生物真題試卷(解析版)
- 阿米巴模式的合同協(xié)議書(shū)
- 新聞?dòng)浾卟删巿?bào)導(dǎo)人員崗位從業(yè)資格考試題含答案
- 隧道居間合同協(xié)議書(shū)范本
- 對(duì)公客戶經(jīng)理培訓(xùn)課件
- 社會(huì)文物鑒定質(zhì)檢服務(wù)機(jī)構(gòu)執(zhí)業(yè)能力認(rèn)可管理體系(公開(kāi)征求意見(jiàn)稿)
- 高標(biāo)準(zhǔn)農(nóng)田建設(shè)監(jiān)理規(guī)范與實(shí)施策略
- 鋼絲繩編接作業(yè)知識(shí)培訓(xùn)
- 人教版八年級(jí)道德與法治下冊(cè)教學(xué)設(shè)計(jì):4.1公民基本義務(wù)
- 接觸網(wǎng)電連接壓接工藝及壓接質(zhì)量檢查課件
評(píng)論
0/150
提交評(píng)論