?? 功能文檔.doc
字號:
學生信息管理系統
Admin:wuqianliang passward:123456
主功能界面
void Main_Menu()
{ char a;
system("cls");
nowtime();
wenttoxy(28,0);printf("****************************\n");
wenttoxy(28,1);printf("* Main Menu *\n");
wenttoxy(28,2);printf("****************************\n");
wenttoxy(28,3);printf("1.Add Stu Info\n");
wenttoxy(28,4);printf("2.Sort Stu Info\n");
wenttoxy(28,5);printf("3.Print Stu Info\n");
wenttoxy(28,6);printf("4.Save Stu Data\n");
wenttoxy(28,7);printf("5.Load Stu Data\n");
wenttoxy(28,8);printf("6.Search Stu Info\n");
wenttoxy(28,9);printf("7.Static Stu Data\n");
wenttoxy(28,10);printf("0.Exit System\n");
wenttoxy(5,18);printf("please enter a number[0-7]:");
wenttoxy(0,24);printf("---Author:WuQianLiang---");
while(1)
{
a=getche();
if(a<'0' || a>'7')
{
wenttoxy(5,19);
printf("your puts is wrong ,please try again");
getch();
}
switch(a)
{
case '0':Exit_System(); getch();out();
case '1':add() ; getch(); break;
case '2':Sort_Stu_Info(); getch() ;break;
case '3':print();PrintInfo( stu, counts, 1,0,1);getch();
case '4':Save_Stu_Data();save( counts);break;
case '5':Load_Stu_Data();load_message();break;
case '6':Search_Stu_Info();getch(); break;
case '7':Static();break;
}
}
}
其中選擇0~7可以進入不同的功能界面,執行相應的操作.如果不是這個范圍內的數字,系統會自動報錯重新輸入.
按數字鍵1可以進入添加學生成績,年齡的界面.
void addcaidan()
{ system("cls");
wenttoxy(28,0);printf("****************************\n");
wenttoxy(28,1);printf("* Add Stu Info *\n");
wenttoxy(28,2);printf("****************************\n");
wenttoxy(28,3);printf("Sno:");
wenttoxy(28,4);printf("Name:");
wenttoxy(28,5);printf("Age:");
wenttoxy(28,6);printf("Chinese:");
wenttoxy(28,7);printf("Enlish:");
wenttoxy(28,8);printf("Chemistry:");
wenttoxy(28,9);printf("Physical:");
wenttoxy(28,10);printf("Math:");
}
其中各項數據的輸入均以回車符結束.如果要修改輸入的信息,可以通過空格鍵和backspace鍵來實現.
各個數據項的輸入如果有錯誤時會自動提示錯誤信息.
當添加完一個學生記錄時,會提示是否繼續添加記錄,如果選擇y或Y則會繼續添加記錄,否則返回主菜單.
主菜單中選擇數字鍵2可以按學號,總分進行升序或降序排列.
void Sort_Stu_Info()
{
char c;
system("cls");
wenttoxy(28,0);printf("****************************\n");
wenttoxy(28,1);printf("* Sort Stu Info *\n");
wenttoxy(28,2);printf("****************************\n");
wenttoxy(28,3);printf("1-------Order By Sno Desc\n");
wenttoxy(28,4);printf("2-------Order By Sno Asc\n");
wenttoxy(28,5);printf("3-------Order By Score Desc\n");
wenttoxy(28,6);printf("4-------Order By Score Asc\n");
wenttoxy(28,7);printf("0-------back to Main Menu\n");
wenttoxy(5,18);printf("Please enter your choose[0-4]:") ;
if(counts==0)
{
printf("it is not having records");
getch();
Main_Menu();
}
while(1)
{
wenttoxy(37,18);
c=getche();
if(!(c>='0' && c<='4'))
{
printf("That you import is illegal character,please try again");
}
else
break;
}
switch(c)
{
case '1':OrderBySno(1);PrintInfo( stu, counts, page,1,1);break;
case '2':OrderBySno(-1);break;
case '3':
OrderByTotscore(1);
PrintInfo( stu, counts, page,0,-1);
break;
case '4':OrderByTotscore(-1);PrintInfo( stu, counts, page,0,-1);break;
case '0':Main_Menu();break;
}
}
如果之前沒有任何的學生記錄,則不進行任何操作,按任意鍵返回主菜單.否則按相應的數字鍵可以進行相應的排序,降序操作.
排序的結果,有提示用戶是否需要打印信息,如果選擇y或Y則打印出所需要的信息,否則按其他鍵返回排序菜單的界面.
void print()
{
system("cls");
wenttoxy(28,0);printf("****************************\n");
wenttoxy(28,1);printf("* print *\n");
wenttoxy(28,2);printf("****************************\n");
}
從主菜單進入打印菜單項之后,可以打印出所有學生的信息,然后按相應的數字鍵可以進行操作.1表示返回上一頁,2表示下一頁,3表示回到第一頁,表示返回最后一頁,6表示刪除,0表示回到主菜單.
查找學生信息:
void Search_Stu_Info()
{ char c;
system("cls");
wenttoxy(28,0);printf("****************************\n");
wenttoxy(28,1);printf("* Search Stu Info *\n");
wenttoxy(28,2);printf("****************************\n");
if(counts==0)
{
printf("it is not having records");
Main_Menu();
}
wenttoxy(28,3);printf("1-------Search By Sno \n");
wenttoxy(28,4);printf("2-------Search By Name\n");
wenttoxy(28,5);printf("0.back to Main Menu\n");
wenttoxy(5,18);printf("Please enter your choose[0-2]:\n") ;
while(1)
{
wenttoxy(36,18);c=getche();
if(!(c>='0' && c<='2'))
{
printf("your puts is wrong");
}
else
break;
}
switch(c)
{
case '1': wenttoxy(28,10);printf("the sno:");SearchBySno();break;
case '2': wenttoxy(28,10);printf("the name:");SearchByName(); break;
case '0': Main_Menu(); break;
}
}
按相應的數字鍵進入查詢選項,查詢的結果可以提示用戶是否需要打印學生信息,還可以對該學生信息進行刪除操作.
統計學生信息:
void Static()
{ char c;
system("cls");
wenttoxy(28,0);printf("****************************\n");
wenttoxy(28,1);printf("* Static Stu Data *\n");
wenttoxy(28,2);printf("****************************\n");
wenttoxy(28,3);
tongjiavg();
wenttoxy(28,7);printf("anykey to continue");getch();
system("cls");
wenttoxy(28,5);printf("1. top three of chinese ");
wenttoxy(28,6);printf("2. top three of english ");
wenttoxy(28,7);printf("3. top three of physic ");
wenttoxy(28,8);printf("4. top three of chemistry ");
wenttoxy(28,9);printf("5. top three of math ");
wenttoxy(28,10);printf("6.top three of allscore");
while(1)
{ c=getche();
if(!('0'<=c && c<='6'))
{
wenttoxy(5,18);printf("your puts is wrong");
}
else
break;
}
switch(c)
{
case '1':system("cls");count(0);break;
case '2':system("cls");count(1);break;
case '3':system("cls");count(2);break;
case '4':system("cls");count(3);break;
case '5':system("cls");count(4);break;
case '6':system("cls");Allscore();break;
case '0':Main_Menu();break;
}
}
進入統計學生信息功能的界面后,直接打印出各個科目的平均分,之后按任意鍵查看各科的前三名和總分的前三名
退出功能:
void out()
{
char c;
if(save(counts)!=counts)/*********記錄是否有沒保存的********************/
{
printf("save(Y/y),exit(n/Y)");
c=getche();
if(c=='y'||c=='Y')/************保存后退出***************************************/
{
save(counts);
exit(0);
}
else
{
if(c=='n'||c=='N')/*********************************退出************************/
exit(0);
else
Main_Menu();
}
}
else
{
printf("will you want exit?");
do
{
c=getche();
if(c=='y'||c=='Y'||c=='n'||c=='N')
break;
else
{
wenttoxy(5,18);printf("your puts is wrong!");
}
}
while(1);
if(c=='y'||c=='Y')
exit(0);
else
Main_Menu();
}
}
記錄沒保存時提示是否需要保存Y或y,選擇其一則表示保存,成功提示保存信息
如果選擇n或N則沒保存學生記錄直接退出,再則其他鍵回到主菜單.
保存和讀取相對路徑和絕對路徑都行,以 字符"\"作為分隔符.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -