




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、精選優(yōu)質(zhì)文檔-傾情為你奉上精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)專心-專注-專業(yè)精選優(yōu)質(zhì)文檔-傾情為你奉上專心-專注-專業(yè)匯編語言程序設(shè)計(jì)期末大作業(yè):編寫一完整的匯編語言源程序,實(shí)現(xiàn)從鍵盤輸入一個班(不少于10人)的學(xué)生記錄(學(xué)號:8位數(shù)字、姓名:不多余10個英文字符,語文:0-100的整數(shù)、數(shù)學(xué):0-100的整數(shù)、英語:0-100的整數(shù))后,(1) 將輸入的記錄保存在C盤根目錄下名為stuscore.dat的文件中;(2) 按照各科成績總分先高后低的順序輸出全部學(xué)生記錄和排名順序;(3) 輸出總分高于班平均總分的全部學(xué)生記錄。stack segment stack db 200 dup
2、(0)stack endsDATA SEGMENT PARA DATAmenu DB * ,0dh,0ah ;主菜單列表 DB * main menu * ,0dh,0ah DB * * ,0dh,0ah DB * 1.output all student score * ,0dh,0ah;輸出所有學(xué)生的成績 DB * 2.statistics score(ABCED) * ,0dh,0ah;顯示每個成績段的學(xué)生人數(shù) DB * 3.sort score * ,0dh,0ah;學(xué)生成績的排序 DB * 4.intput five names and scores * ,0dh,0ah;任意添加五
3、個學(xué)生的姓名與成績 DB * 5.intput one name and score * ,0dh,0ah;任意輸入一個學(xué)生的姓名與成績,會顯示出其成績的等級 DB * 6.clear screen * ,0dh,0ah;清屏 DB * 7.exit * ,0dh,0ah;退出 DB * ,0dh,0ah Plase DBplasechoose:(1-7): ,0dh,$ ;選擇1-7 err db the data error$put0 db plase intput one name and score,0dh,$put db plase intput five names and sco
4、res,0dh,$bye db *thank you to use*,0dh,$score dw 64,71,66,61,78,80,83,89,79,96n1 =($-score)/2;score的長度scoreadd DB 3; 增加的分?jǐn)?shù)存入指定單元 DB ? DB 3 DUP(0) db $scoreadd2 DB 3; 增加的分?jǐn)?shù)存入指定單元 DB ? DB 3 DUP(0) db $scoreadd3 DB 3; 增加的分?jǐn)?shù)存入指定單元 DB ? DB 3 DUP(0) db $scoreadd4 DB 3; 增加的分?jǐn)?shù)存入指定單元 DB ? DB 3 DUP(0) db $ sc
5、oreadd5 DB 3; 增加的分?jǐn)?shù)存入指定單元 DB ? DB 3 DUP(0) db $score1 db 15 dup(0)mes1 DB THE NUMBER OF E(0-59):$; 顯示E等級的人數(shù)的界面,對應(yīng)V1mes2 DB THE NUMBER OF D(60-69):$; 顯示D等級的人數(shù)的界面,對應(yīng)V2mes3 DB THE NUMBER OF C(70-79):$; 顯示C等級的人數(shù)的界面,對應(yīng)V3mes4 DB THE NUMBER OF B(80-89):$; 顯示B等級的人數(shù)的界面,對應(yīng)V4mes5 DB THE NUMBER OF A(90-100):$;
6、顯示A等級的人數(shù)的界面,對應(yīng)V5mes6 DB $; 12字節(jié)空格使顯示分?jǐn)?shù)及對應(yīng)名字相隔mes7 db name: score:,0ah,0dh,$mes8 db name:,0ah,0dh,$; 提示輸入姓名mes9 db score:,0ah,0dh,$; 提示輸入分?jǐn)?shù)bo1 DB you input the score of student is A$; 判斷輸入的數(shù)據(jù)的等級后顯示對應(yīng)級別Abo2 DB you input the score of student is B$; 判斷輸入的數(shù)據(jù)的等級后顯示對應(yīng)級別Bbo3 DB you input the score of studen
7、t is C$; 判斷輸入的數(shù)據(jù)的等級后顯示對應(yīng)級別Cbo4 DB you input the score of student is D$; 判斷輸入的數(shù)據(jù)的等級后顯示對應(yīng)級別Dbo5 DB you input the score of student is E$; 判斷輸入的數(shù)據(jù)的等級后顯示對應(yīng)級別Ebo6 DB 1.output all student score 2.statistics score(ABCED) DB 3.sort score 4.intput five names and scores DB 5.intput one name and score 6.clear s
8、creen 7.exit ,0dh,$ ;清屏后提示v1 db ? ;0-59段人數(shù)計(jì)數(shù)器 v2 db ? ;60-69段人數(shù)計(jì)數(shù)器 v3 db ? ;70-79段人數(shù)計(jì)數(shù)器 v4 db ? ;80-89段人數(shù)計(jì)數(shù)器 v5 db ? ;90-100段人數(shù)計(jì)數(shù)器 nam1 DB chen bo$; 學(xué)生姓名已存入指定數(shù)據(jù)存儲單元NAM(1-10)nam2 DB chenhin$nam3 DB chenhun$nam4 DB huanwei$nam5 DB tanghui$nam6 DB chenfan$nam7 DB mao yun$nam8 DB zhanjun$nam9 DB zhanhua
9、$nam10 DB chenlin$nam11 DB 8; 增加的名字存入指定單元 DB ? DB 8 DUP(0) nam12 DB 8 DB ? DB 8 DUP(0) nam13 DB 8 DB ? DB 8 DUP(0) nam14 DB 8 DB ? DB 8 DUP(0) nam15 DB 8 DB ? DB 8 DUP(0) ;NUM DB 21,22,23,24,25,26,27,28,29,30;*顯示*show macro m lea dx,m mov ah,9 int 21h endm;*輸入*input macro f lea dx,f mov ah,10 int 21
10、H endmDATA ENDSCODE SEGMENT ASSUME CS:CODE,DS:DATA,SS:STACK,ES:DATASTART PROC MOV AX,DATA mov ds,AX show menuchen: show plase mov ah,1;選擇菜單項(xiàng) int 21h call ad cmp al,7 ja error ;當(dāng)輸入非法數(shù)據(jù)時(shí),報(bào)錯 cmp AL,1 jb error; 當(dāng)輸入非法數(shù)據(jù)時(shí),報(bào)錯 CMP AL,1 JE one; 當(dāng)輸入1時(shí),轉(zhuǎn)入分支程序,實(shí)現(xiàn)輸出分?jǐn)?shù)及名字功能 CMP AL,2 JE two; 當(dāng)輸入2時(shí),轉(zhuǎn)入TWO分支程序,實(shí)現(xiàn)統(tǒng)計(jì)功能
11、 CMP AL,3 JE three; 當(dāng)輸入3時(shí),轉(zhuǎn)入THREE分支程序,實(shí)現(xiàn)排序功能 cmp AL,4 JE fo; 當(dāng)輸入4時(shí),轉(zhuǎn)入FO分支程序,實(shí)現(xiàn)鍵盤輸入功能及輸出 cmp AL,5 je fiv; 當(dāng)輸入5時(shí),轉(zhuǎn)入FO分支程序,實(shí)現(xiàn)鍵盤輸入功能能及等級判斷 cmp al,6 je six;當(dāng)輸入6時(shí),轉(zhuǎn)入SIX分支程序,實(shí)現(xiàn)清屏 CMP AL,7 jmp byebye; 當(dāng)輸入7時(shí),轉(zhuǎn)入BYEBYE分支程序,退出error: ;分支程序,當(dāng)輸入非法數(shù)據(jù)時(shí),報(bào)錯 show err call ad jmp chenquit: ; 分支程序,退出 mov ah,4ch int 21hby
12、ebye: show bye jmp quit ;* 1顯示所有成績 *one: ; ONE分支程序,實(shí)現(xiàn)輸出分?jǐn)?shù)及名字功能 mov cx,n1 lea di,score show mes7 mov bp,offset nam1chen1:;*以下顯示姓名* mov dx,bp mov ah,9 int 21h add bp,8 show mes6;*以下顯示分?jǐn)?shù)* mov ax,di mov bx,10 lea si,score1 call radix mov si,byte ptr 0dh mov si+1,byte ptr 0ah mov si+2,byte ptr $ lea dx,s
13、core1 mov ah,9 int 21h;以上是2-10進(jìn)制轉(zhuǎn)換及顯示 add di,2;*以上顯示分?jǐn)?shù)* dec cx jnz chen1 jmp chen;*2-10*radix proc;2-10進(jìn)制轉(zhuǎn)換 push cx;(cx)=10 push dx; mov cx,0;P進(jìn)制入站時(shí)的計(jì)數(shù)器L1: MOV DX,0 DIV BX;商置ax, push dx; inc cx or ax,ax jne L1l2: pop ax;出棧 cmp al,10;比較 jb next;跳入下一個 add al,7;進(jìn)行加法運(yùn)算next: add al,30h mov si,al inc si d
14、ec cx jnz l2 pop dx;出棧 pop cx;出棧 retradix endp; *2號統(tǒng)計(jì)各分段人數(shù) *two: lea si,score mov cx,n1 call count ;統(tǒng)計(jì)各分段人數(shù) call ad jmp chen; *3號順序分?jǐn)?shù)排序 *three: lea bx,score mov cx,n1 call sort;排序并存放在score為首址的單元中;*顯示所有成績* mov cx,n1 lea di,scorechen2: ;*冒泡排序子程序*sort proc;P128排序 push ax;入棧 push dx;入棧 push si;入棧 push d
15、i ;入棧 mov dx,cx sub dx,2 mov si,2lopi: mov ax,di mov bx,10 lea si,score1 call radix mov si,byte ptr 0dh mov si+1,byte ptr 0ah mov si+2,byte ptr $ lea dx,score1 mov ah,9 int 21h;以上是2-10進(jìn)制轉(zhuǎn)換及顯示 add di,2 dec cx jnz chen2 jmp chen mov di,si add di,2 mov ax,bx+si-2lopj: cmp ax,bx+di-2 jbe lopk xchg bx+di
16、-2,ax mov bx+si-2,axlopk: show mes8;顯示信息 input nam12 call ad show mes9;顯示信息 input scoreadd2 call ad;調(diào)動程序 show mes8;顯示信息 input nam13 call ad;調(diào)動程序 show mes9;顯示信息 input scoreadd3 call ad;調(diào)動程序 add di,2 cmp di,20 jbe lopj add si,2 cmp si,18;比較 jbe lopi pop di pop si;出棧 pop dx ;出棧 pop ax;出棧 ret;返回sort end
17、p; *4輸出輸入成績*fo: show put;顯示 call ad show mes8;顯示信息 input nam11;輸入姓名 call ad show mes9;顯示信息 input scoreadd;輸入 call ad;調(diào)動程序 show mes8 input nam14 call ad show mes9 input scoreadd4 call ad ;*顯示對應(yīng)名字分?jǐn)?shù)* show mes7;顯示對應(yīng)名字分?jǐn)?shù) ; call ad show nam11+2;顯示name show mes6 show scoreadd+2;顯示score call ad show nam12+
18、2;顯示name show mes6 show scoreadd2+2;顯示score call ad show nam13+2;顯示name show mes6 show scoreadd3+2;顯示score call ad show nam14+2;顯示name show mes6 show scoreadd4+2;顯示score call ad show nam15+2;顯示name show mes6 show scoreadd5+2;顯示score call ad jmp chen fiv: ; *6清屏程序*six: call clr show bo6 jmp chen show
19、 put0 call ad show mes8 input nam11;輸入姓名 call ad show mes9;顯示信息 input scoreadd;輸入分?jǐn)?shù) call ad show put call ad show mes8;顯示信息 input nam11;輸入姓名 call ad;調(diào)用 show mes9;顯示信息 input scoreadd call ad show mes7;顯示對應(yīng)名字分?jǐn)?shù) show nam11+2;顯示name show mes6 show scoreadd+2;顯示score call ad lea bx,scoreadd+2 call abcde
20、call ad jmp chen ;*判斷ABCDE子程序*abcde proc push ax;入棧 mov ax,0 lea bx,scoreadd+2 mov ah,bx inc bx mov al,bx;把bx中所存地址包含的內(nèi)容移動到alb1: cmp ax,59;與59進(jìn)行比較 jg b2; show bo5;0-59 call ad jmp chen;跳到chen:執(zhí)行程序b2: cmp ax,69;與69進(jìn)行比較 jg b3 ;60-69 show bo4 call ad jmp chen;跳到chen:執(zhí)行程序 b3: cmp ax,79;與79進(jìn)行比較 jg b4 ;70-
21、79 show bo3 call ad jmp chen;跳到chen:執(zhí)行程序b4: cmp ax,89;與89進(jìn)行比較 jg b5 ;80-89 show bo2 call ad jmp chen;跳到chen:執(zhí)行程序b5: show bo1 call ad jmp chen pop axabcde endp ; *統(tǒng)計(jì)成績子程序 *count procm1:loop m1 mov dx,offset mes1 mov ah,09h int 21h mov dl,v1 add dl,30h mov ah,02h int 21h call ad mov bx,si add si,2 cmp bx,59 jg m2; inc v1 ; 0-59段人數(shù)計(jì)數(shù)器 jmp m6 ;0-59m2: cmp bx,69 jg m3 ;60-69 inc v2 ; 60-69段人數(shù)計(jì)數(shù)器 jmp m6 m3: cmp bx,79 jg m4 ;70-79 inc v3 ; 70-79段人數(shù)計(jì)數(shù)器 jmp m6 m4: cmp bx,89 jg m5 ;80-89 inc v4 ; 80-89段人數(shù)計(jì)數(shù)器 jmp
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 家具拆卸搬運(yùn)合同范本
- 點(diǎn)火系統(tǒng):點(diǎn)火開關(guān)競爭策略分析報(bào)告
- 中醫(yī)護(hù)理質(zhì)量自查報(bào)告
- 個人股份協(xié)議書
- 個人租房合同簡易版
- 廈門運(yùn)輸合同范例
- 賣煤提成合同范例
- 丑小鴨閱讀心得體會
- 廠房裝修材料合同范本
- 廚房櫥柜合同范本
- GB 21240-2007液壓電梯制造與安裝安全規(guī)范
- 家具廠安全生產(chǎn)操作規(guī)程大全
- 神經(jīng)病學(xué)-緒論課件
- 危險(xiǎn)化學(xué)品全表
- 公路施工技術(shù)全套課件
- 胸痹心痛中醫(yī)診療方案及臨床路徑
- 泛讀2unit2-music
- 中學(xué)生防溺水安全教育課件(PPT 44頁)
- 2019版外研社高中英語選擇性必修二Unit 1 Growing up 單詞表
- 有機(jī)金屬化學(xué)1
- JIT標(biāo)準(zhǔn)作業(yè)作業(yè)指導(dǎo)書
評論
0/150
提交評論