汇编程序-学生信息管理系统(源代码).docx_第1页
汇编程序-学生信息管理系统(源代码).docx_第2页
汇编程序-学生信息管理系统(源代码).docx_第3页
汇编程序-学生信息管理系统(源代码).docx_第4页
汇编程序-学生信息管理系统(源代码).docx_第5页
已阅读5页,还剩31页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

微机原理与接口技术题:一个学生的信息包括姓名、班级、学号、成绩,其中成绩需要精确到一位小数。试编写程序实现以下功能:(1) 可以录入学生成绩(十进制形式);(2) 可以按要求(如学号或成绩)进行排序显示;(3) 可以统计平均成绩;(4) 可以统计不及格、6070、7080、8090、90100各分数段的人数。;数组:name:存放姓名s_id:存放学号 s_id1:存放排序后的学号 number:原先排列序号 number1:排序后的排列序号 grade:学生成绩 grade1:经过排序后的学生成绩data segmentsname db whq , yxm , dxq , yhh , fww , gxj , ldx , lyh , zxt ,$banji db2010211201,2010211202,2010211201,2010211205,2010211205,2010211201,2010211203,2010211206,2010211202,$grade dw 234,356,876,856,874,902,738,839,927,$grade1 dw 9 dup(?)cishu dw 0cishu1 dw 0number db 1,2,3,4,5,6,7,8,9,$number1 db 1,2,3,4,5,6,7,8,9,$s_id db 10211009,10211002,10211003,10211004,10211005,10211006,10211007,10211008,10211001,$s_id1 db 72 dup(?),$str1 db want to input grade? y/Y or n/N,$str2 db please input y/Y or n/N,$str3 db sort by student_id or grade? i/I or g/G.or press ENTER to jump this step,$str4 db please input i/I or g/G.or press ENTER to jump this step,$str5 db show the average score? y/Y or n/N ,$str6 db count the number of students in different range? y/Y or n/N,$str7 db press 1 to input grade, press 2 to sort, press 3 to show the average score,press 4 to count the number of students in different range, else, end the program,$string1 db please input numbers or . :,$string2 db please input grade, press space to save the last grade and input the grade of the next student(9 students in total):,$string3 db out of range,reinput please!,$avera db the average score is:,$zancun dw 0aa db ?bb db ?cc db ?ddd db ?ee db ?zongde db there are ,$bujige db students failed in the exam,$liushi db students get 6070,$qishi db students get 7080,$bashi db students get 8090,$jiushi db students get 90100,$xingming db sname,$class db banji,$xuehaoa db s_id,$chengji db grade,$data endscode segment assume cs:code,ds:datastart:mov ax,datamov ds,axfirst:mov dl,0ahmov ah,02int 21hmov dx,offset str1;显示成绩输入提示字符串mov ah,9int 21hkaishi:mov ah,1int 21hcmp al,yjz shuru ;输入Y、y则输入成绩cmp al,Yjz shurucmp al,njz next2 ;输入n、N则下一步cmp al,Njz next2mov dl,0ah;输入其他字符则换行并显示错误提示字符串mov ah,02int 21hmov dx,offset str2mov ah,9int 21hjmp kaishishuru:mov dl,0ahmov ah,02int 21hcall input;输入成绩next2:mov dl,0ahmov ah,02int 21hmov dx,offset str3;排序提示字符串mov ah,9int 21hagain:mov ah,1int 21hcmp al,ijz id_rank;输入i/I则按学号排序cmp al,Ijz id_rankcmp al,gjz g_rank;输入g/G则按成绩排序cmp al,Gjz g_rankcmp al,0dh;回车跳过本步骤jz next3mov dl,0ahmov ah,02int 21hmov dx,offset str4;否则显示错误提示字符串mov ah,9int 21hjmp againid_rank:mov dl,0ahmov ah,02int 21hcall idrankjmp next3g_rank:mov dl,0ahmov ah,02int 21hcall granknext3:mov dl,0ahmov ah,02int 21hmov dx,offset str5;显示统计平均成绩提示字符串mov ah,9int 21hagain1:mov ah,1int 21hcmp al,yjz aver;输入Y、y则统计平均成绩cmp al,Yjz avercmp al,njz next4;输入n、N则跳过本步cmp al,Njz next4mov dl,0ahmov ah,02int 21hmov dx,offset str2;否则显示错误提示字符串mov ah,9int 21hjmp again1zj1:jmp firstzj2:jmp next2zj3:jmp next3aver:mov dl,0ahmov ah,02int 21hcall averagenext4:mov dl,0ahmov ah,02int 21hmov dx,offset str6;显示统计各分数段人数提示字符串mov ah,9int 21hagain2:mov ah,1int 21hcmp al,yjz next5;输入Y、y则统计各分数段人数cmp al,Yjz next5cmp al,njz done;输入n、N则下一步cmp al,Njz donemov dl,0ah;换行显示错误提示字符串mov ah,02int 21hmov dx,offset str2mov ah,9int 21hjmp again2next5:mov dl,0ahmov ah,02int 21hcall countdone:;mov dl,0ah;mov ah,02;int 21h;mov dx,offset str7;是否重新进行先前的步骤;mov ah,9;int 21h;again3:mov ah,1;int 21h;cmp al,1;jz zj1;cmp al,2;jz zj2;cmp al,3;jz zj3;cmp al,4;jz next4;jmp lastlast:MOV AH,4CH INT 21H input proc near;输入学生成绩子程序mov dx,offset string2mov ah,9int 21hmov dl,0ahmov ah,02int 21hlea si,gradell:mov cx,45lz:mov bx,0one:mov ah,01hint 21hcmp al,0dh;回车结束jz donrcmp al, ;输入空格键则指向下一个学生成绩jz next7cmp al,0 ;09继续,9错误,0且不为.也错误jnc next6cmp al,.jnz wrongjz lopnext6:cmp al,9ja wrongjmp shunext7:mov si,bxadd si,2mov bx,0jmp lopshu:sub al,30hcbwxchg ax,bxmov dx,10mul dxxchg ax,bxadd bx,axcmp bx,1000ja outoflop:loop onejmp donrwrong:mov dl,0ah;出现错误则从头输入mov ah,02int 21hmov dx,offset string1mov ah,9int 21hjmp lloutof:mov dl,0ahmov ah,02int 21hmov dx,offset string3mov ah,9int 21hmov dl,0ahmov ah,02int 21hjmp lldonr:retinput endpidrank proc near;按学号排序子程序mov cx,72;把s_id中的成绩传送给s_id1lea si,s_idlea di,s_id1l2:mov ax,simov di,axadd si,1add di,1loop l2mov cx,8;冒泡排序PAI1: PUSH CX ;保存外循环次数 lea si,s_id1 mov di,0PAI2: MOV AX,SI+7 CMP AX,SI+15 JGE NEXT1 ;降序 XCHG AX,SI+15 ;交换 MOV SI+7,AX MOV AL,NUMBER1DI ;交换名次 XCHG AL,NUMBER1DI+1 MOV NUMBER1DI,ALNEXT1: ADD SI,8 ;SI指向下一个学号 INC DI LOOP PAI2 POP CX LOOP PAI1mov dl,0ahmov ah,02int 21hcall idxianshiretidrank endpgrank proc near;按成绩排序子程序mov cx,9;把grade中的成绩传送给grade1lea si,gradelea di,grade1l1:mov ax,simov di,axadd si,2add di,2loop l1mov cx,8;冒泡排序PAIXU1: mov bx,cx ;保存外循环次数 lea si,grade1 mov di,0PAIXU2: MOV AX,SI CMP AX,SI+2 JNC NEXT ;降序 XCHG AX,SI+2 ;交换 MOV SI,AX MOV AL,NUMBERDI ;交换名次 XCHG AL,NUMBERDI+1 MOV NUMBERDI,ALNEXT: ADD SI,2 ;SI指向下一个数 INC DIdec bx jnz PAIXU2 LOOP PAIXU1mov dl,0ahmov ah,02int 21hcall gxianshiretgrank endpaverage proc near;显示平均成绩子程序mov dx,offset averamov ah,9int 21hlea si,grademov ax,simov cx,8jiafa:add ax,si+2add si,2loop jiafamov bx,9mov dx,0idiv bx;除以9,商存入AX,余数存入DXmov zancun,dxMOV CX,0;以下显示商部分MOV BX,10SHUCHU2:MOV DX,0INC CXIDIV BX ;商存入AX,余数存入DXPUSH DX ;保存余数CMP AX,0JNZ SHUCHU2dec cxSHUCHU3:POP AX ;取出余数,放入AXADD AX,0030HMOV DL,AL ;输出MOV AH,2INT 21HLOOP SHUCHU3mov dl,.;显示.mov ah,2int 21hpop axmov cx,0mov cx,ax;小数部分先存入cxmov ax,zancun;取出除以9之后的余数mov bl,10mul bl;乘以10后再除以9mov bx,9mov dx,0idiv bx;商存入AX,余数存入DXcmp ax,5;小于5不变,否则cx加1jc xianshiadd cx,1xianshi:mov dl,cladd dl,30hmov ah,2int 21hretaverage endpcount proc near;显示各分数段人数子程序mov aa,0mov bb,0mov cc,0mov ddd,0mov ee,0mov cx,9lea si,graderepet:mov ax,sicmp ax,600jc aa1cmp ax,700jc bb1cmp ax,800jc cc1cmp ax,900jc dd1jmp ee1aa1:inc aajmp wefbb1:inc bbjmp wefcc1:inc ccjmp wefdd1:inc dddjmp wefee1:inc eejmp wefwef:add si,2loop repetmov dx,offset zongdemov ah,9int 21hadd aa,30hmov dl,aamov ah,02int 21hmov dx,offset bujigemov ah,9int 21hmov dl,0ahmov ah,2int 21hmov dx,offset zongdemov ah,9int 21hadd bb,30hmov dl,bbmov ah,02int 21hmov dx,offset liushimov ah,9int 21hmov dl,0ahmov ah,2int 21hmov dx,offset zongdemov ah,9int 21hadd cc,30hmov dl,ccmov ah,02int 21hmov dx,offset qishimov ah,9int 21hmov dl,0ahmov ah,2int 21hmov dx,offset zongdemov ah,9int 21hadd ddd,30hmov dl,dddmov ah,02int 21hmov dx,offset bashimov ah,9int 21hmov dl,0ahmov ah,2int 21hmov dx,offset zongdemov ah,9int 21hadd ee,30hmov dl,eemov ah,02int 21hmov dx,offset jiushimov ah,9int 21hmov dl,0ahmov ah,2int 21hretcount endpgxianshi proc near;将进行按成绩排序后的学生信息依次显示mov dx,offset xingmingmov ah,9int 21hmov cx,3konggea:mov dl, mov ah,2int 21hloop konggeamov dx,offset classmov ah,9int 21hmov cx,6konggeb:mov dl, mov ah,2int 21hloop konggebmov dx,offset xuehaoamov ah,9int 21hmov cx,3kongge1:mov dl, mov ah,2int 21hloop kongge1mov dx,offset chengjimov ah,9int 21hmov dl,0ahmov ah,2int 21h mov cx,9mov di,0paixuxianshi:push cxmov bx,0mov cx,0ming:mov ax,0mov al,numberdidec almov bl,5mul bllea si,snameadd si,axmov cx,5let0:mov ah,2mov dl,siint 21hinc siloop let0mov ah,2mov dl, int 21hban:mov ax,0mov al,numberdidec almov bl,10mul bllea si,banjiadd si,axmov cx,10let1:mov ah,2mov dl,siint 21hinc siloop let1mov ah,2mov dl, int 21hjmp xuehaozj4:loop paixuxianshijmp chuquxuehao:mov ax,0mov al,numberdidec almov bl,8mul bllea si,s_idadd si,axmov cx,8let2:mov ah,2mov dl,siint 21hinc siloop let2mov ah,2mov dl, int 21hcheng:mov ax,0mov al,numberdidec almov bl,2mul bllea si,gradeadd si,axmov ax,simov cx,0mov bx,10shuc2:mov dx,0inc cxidiv bxpush dxcmp ax,0jnz shuc2dec cxshuc3:pop axadd ax,0030hmov dl,almov ah,2int 21hloop shuc3mov dl,.mov ah,2int 21hpop axadd ax,0030hmov dl,almov ah,2int 21hmov dl,0ahmov ah,2int 21hinc dipop cxjmp zj4;loop paixuxianshichuqu:retgxianshi endp idxianshi proc near;将进行按成绩排序后的学生信息依次显示mov dx,offset xingmingmov ah,9int 21hmov dl,mov ah,2int 21hmov dx,offset classmov ah,9int 21hmov dl,mov ah,2int 21hmov dx,offset xuehaoamov ah,9int 21hmov cx,3kongge3:mov dl, mov ah,2int 21hloop kongge3mov dx,offset chengjimov ah,9int 21hmov dl,0ahmov ah,2int 21h mov cx,9mov di,0pa

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论