xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

  • 大小: 5KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-06-09
  • 語(yǔ)言: C/C++
  • 標(biāo)簽: 中序輸出??

資源簡(jiǎn)介

利用二叉排序樹實(shí)現(xiàn)學(xué)生成績(jī)處理 (1)每個(gè)學(xué)生信息包括:學(xué)號(hào),姓名,成績(jī)?nèi)齻€(gè)字段 (2)創(chuàng)建:按成績(jī)構(gòu)建二叉排序樹,存儲(chǔ)學(xué)生數(shù)據(jù); (3)查找:在建立好的二叉排序樹中,根據(jù)學(xué)號(hào)或姓名查找學(xué)生成績(jī); (4)排序:對(duì)學(xué)生信息按照成績(jī)進(jìn)行排序;

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#?define?max?100
#?define??null?0

??
struct?student?????//定義學(xué)生實(shí)體結(jié)構(gòu)體
{
????int?id;
char?name[15];
float?score;
????struct?student?*lchild*rchild;
};


struct?student?*inserttree(struct?student?*tree);//錄入信息的函數(shù)
struct?student?*find_id(struct?student?*tree?int?x);//按學(xué)號(hào)查找
struct?student?*find_name(struct?student?*treechar?*name);//按姓名查找
void?midorder(struct?student?*tree);//中序輸出信息




int?main()???//主函數(shù)
{
????int?choose;
????struct?student?*tree?*findi;
????int?flag?id;
char?name[15];
????flag=1;
????tree=null;

????do
????{
????????????printf(“\n\n************************************************\n\n\n“);
????????????printf(“----------------歡迎使用本系統(tǒng)\n\n1----------創(chuàng)建排序二叉樹并錄入學(xué)生信息\n\n“);
printf(“2----------按學(xué)號(hào)查找\n\n3----------按姓名查找\n\n“);
????????????printf(“4----------按成績(jī)排序輸出\n\n“);
????????????printf(“\n\n************************************************\n“);
????????????scanf(“%d“&choose);
????????????switch(choose)
????????????{
????????????????????case?1:
tree=inserttree(tree);
????????????????????????break;
????????????????????case?2:
printf(“請(qǐng)輸入要查找的學(xué)生的學(xué)號(hào):“);
????????????????????????scanf(“%d“&id);
????????????????????????findi=find_id(treeid);
????????????????????????if(findi==null)
printf(“沒有找到符合要求的學(xué)生\n\n“);
????????????????????????else
printf(“該學(xué)生信息為學(xué)號(hào)%d\t姓名%s\t分?jǐn)?shù)%.1f\n\n“findi->idfindi->namefindi->score);
????????????????????????break;
????????????????????case?3:
printf(“請(qǐng)輸入要查找的學(xué)生的姓名:“);
????????????????????????scanf(“%s“&name);
????????????????????????findi=find_name(treename);
????????????????????????if(findi==null)
printf(“沒有找到符合要求的學(xué)生\n\n“);
????????????????????????else
printf(“該學(xué)生信息為學(xué)號(hào)%d\t姓名%s\t分?jǐn)?shù)%.1f\n\n“findi->idfindi->namefindi->score);
????????????????????????break;
????????????????????case?4:
if(tree!=NULL)
{
printf(“學(xué)生信息為:\n\n\n“);
????????????????????????????midorder(tree);
}
else
printf(“暫時(shí)沒有學(xué)生信息!\n\n\n“);
????????????????????????break;
????????????????????
????????????????????default:?printf(“error\n“);
????????????}
?????????printf(“繼續(xù)操作請(qǐng)

評(píng)論

共有 條評(píng)論

相關(guān)資源