數(shù)據(jù)結(jié)構(gòu)課程設(shè)計ppt.ppt_第1頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計ppt.ppt_第2頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計ppt.ppt_第3頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計ppt.ppt_第4頁
數(shù)據(jù)結(jié)構(gòu)課程設(shè)計ppt.ppt_第5頁
已閱讀5頁,還剩29頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、,數(shù)據(jù)結(jié)構(gòu),學生成績管理系統(tǒng),吳靈珊,許梅瓊,梁春梅,14計科2班 第12組,王芬嵐,2020/7/29,A,問,基本操作函數(shù),學生成績管理系統(tǒng),01,02,03,04,問題描述,結(jié)構(gòu)分析,基本操作函數(shù),運行,14計科2班 第12組,voidStuSave(Student*);/ 學生成績管理系統(tǒng)的存儲函數(shù),由主函數(shù)調(diào)用 基本操作函數(shù): voidStuOutput(Student*p);/ 輸出函數(shù) intStuImport(Student*head,Student*p);/輸入函數(shù) voidStuInputHand(Student*head);/ 學生成績管理系統(tǒng)的手動輸入函數(shù),由輸入函 數(shù)

2、調(diào)用,voidStuInputFile(Student*head);/ 學生成績管理系統(tǒng)的文件輸入函數(shù),由輸入函數(shù)調(diào)用 voidStuSelectErg(Student*head);/ 學生成績管理系統(tǒng)的遍歷函數(shù),由查找函數(shù)調(diào)用 voidStuSelectNumFind(Student*head);/學生成績管理系統(tǒng)的按學號查找函數(shù),由查找函數(shù)調(diào)用 voidStuSelectSubFind(Student*head);/學生成績管理系統(tǒng)的按科目查找函數(shù),由查找函數(shù)調(diào)用,2020/7/29,源程序,2020/7/29,#include/輸入輸出頭文件 #include #include #inc

3、lude #include class student/班級學生 private: char name20; /姓名 double cpro,english,math,sport,law,hbpro,computer;/課程 int order, number; /名次,學號 public:,student() student(char n20,int nu,double cc,double eng,double ma,double sp,double,2020/7/29,l,double hb,double com) strcpy(name,n); number=nu; cpro=cc; e

4、nglish=eng;math=ma;sport=sp;law=l;hbpro=hb;computer=com; friend void main(); ; void main() cout 歡迎進入*學生成績管理系統(tǒng)*!endl; cout *endl;,2020/7/29,cout * 學生成績管理系統(tǒng) *endl; cout *endl; cout *endl; cout *0、輸入數(shù)據(jù) *endl; cout *1、增加數(shù)據(jù) *endl; cout *2、修改數(shù)據(jù) *endl; cout *3、按姓名查詢 *endl; cout *4、按學號查詢 *endl; cout *5、輸出所有

5、學生的成績 *endl; cout *6、退出系統(tǒng) *endl; cout,*endl; cout 選擇0-6數(shù)字進行操作endl;,2020/7/29,char p;char w;/定義字符型p、w student *s50; /指針對象,最多存50個學生數(shù)據(jù) ofstream *file50; /負責對文件插入操作 int i=0;/定義初始化i=0 int j=0;/定義初始化j=0 int flag=0;/定義變量初始化變量等于0 do /flag判斷輸入是否有效 cinp; if(p=0 else,cout 指令錯誤!請重新輸入:endl;,2020/7/29,while(flag=

6、0); do switch(p) /接收功能選項 case 0: /輸入數(shù)據(jù) char c;/定義一個字符型c char name20;int number;double cpro,english,math,sport,law,hbpro,computer; /定義了一個數(shù)組,數(shù)組名為name,數(shù)組元素的個數(shù)為20 定義 do coutname; coutnumber;,2020/7/29,coutcpro; coutenglish; coutmath; coutsport; coutlaw; couthbpro; coutendl 請輸入數(shù)據(jù)庫成績:;,2020/7/29,cincomput

7、er; coutc; coutendl; do ,2020/7/29,if(c!=ydouble /,2020/7/29,cpro,english,math,sport,law,hbpro,computer; char c; do coutname; coutnumber; coutcpro; coutenglish; coutendl 請輸入數(shù)學成績:;,2020/7/29,cinmath; coutsport; coutlaw; couthbpro; coutcomputer; coutendl; filej=new ofstream(d: document,ios:ate); *file

8、j 姓名 name 學號,2020/7/29,c; coutc; ,2020/7/29,while(c=y); break; case 2: /修改數(shù)據(jù) char name20;int nu;double cc,eng,ma,sp,l,hb,com;flag=0; char c; if(i=0) cout 管理系統(tǒng)中沒有輸入數(shù)據(jù)!endl;break; do ,2020/7/29,coutname; coutname)=0) flag=1; coutnu; coutcc; coutendl 請輸入英語成績:;,2020/7/29,cineng; coutma; coutsp; coutl; c

9、outhb; coutcom; coutcpro=cc;,2020/7/29,sh-english=eng; sh-math=ma; sh-sport=sp; sh-law=l; sh-hbpro=hb; sh-computer=com; sh-number=nu; cout 數(shù)據(jù)修改成功!endl; if(flag=0)/判斷要修改的學生數(shù)據(jù)是否存在 cout 您要修改的學生本來就不存在!請檢查重新輸入!endl;,2020/7/29, coutc; coutc; while(c=y); break; ,2020/7/29,case 3: /按姓名查詢 char n20;int j=0;ch

10、ar c; if(i=0)/學生姓名不存在的情況 coutn; coutendl; for(int j=0;ji;j+),2020/7/29, if(strcmp(n,(*sj).name)=0) flag=1; coutc;,2020/7/29,coutc; while(c=y);/輸入Y表示繼續(xù)按照姓名查詢 break; case 4: /按學號查詢 int n,j=0;char c;,2020/7/29,if(i=0)/學生數(shù)據(jù)不存在的情況 coutn; coutnumber=n) flag=1;,2020/7/29,coutc; coutc;,2020/7/29, while(c=y)

11、;/; /*y=x是賦值語句,表示將x的值賦值給y,那么while(y=x) 可以理解為當x=0,即y=x=0時跳出循環(huán),如果x為其它非零數(shù),則執(zhí)行循環(huán)體*/ break; case 5: /輸出 cout 本系統(tǒng)所有學生數(shù)據(jù)如下:endl;/輸出 if(i=0) cout 管理系統(tǒng)中沒有輸入數(shù)據(jù)!endl; cout 姓名 學號 c+ 英語 數(shù)學 體育 網(wǎng)絡(luò)基礎(chǔ) C語言 數(shù)據(jù)庫 endl; for(int k=0;ki;k+) ,2020/7/29,coutnamenumbersetw(6)/*函數(shù)setw(int n)用來控制輸出間隔。超出則按實際長度輸出*/ (*sk).cprosetw

12、(6)(*sk).englishsetw(6) /cpro與english間隔為6 (*sk).mathsetw(6)(*sk).sportsetw(7) (*sk).law setw(10)(*sk).hbprosetw(10)(*sk).computersetw(10)endl; break; case6:/退出 exit(0); coutBye bye!endl; /輸出Bye bye cout 您想繼續(xù)進行其他操作嗎?(y/n):; int flag=0; ; /定義一個int型變量flag,并且給flag賦初始值為0 do,2020/7/29, cinw; ; /標準輸入流 相當于c的scanf coutendl; if(w!=y,202

溫馨提示

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

最新文檔

評論

0/150

提交評論