汇编学生成绩管理
❶ 用汇编编写,学生成绩管理系统
转帖的:
stacks segment stack
dw 128 p(?)
stacks ends
datas segment
records db 'name1$',100,83,97,94,95
db 'name2$',75,78,98,65,78
db 'name3$',54,87,95,84,95
db 'name4$',87,95,84,65,75
db 'name5$',75,81,82,86,97
db 'name6$',87,98,85,82,90
db 'name7$',51,67,87,54,68
db 'name8$',75,81,91,85,84
db 'name9$',84,87,82,91,73
db 'namea$',72,80,83,81,91
db 'nameb$',87,89,82,90,79
db 'namec$',74,84,80,70,69
db 'named$',84,84,82,99,100
db 'namee$',54,78,89,81,97
db 'namef$',75,84,80,91,90
db 'nameg$',72,81,86,91,89
db 'nameh$',81,82,94,76,70
db 'namei$',42,56,75,61,69
db 'namej$',75,48,84,56,48
db 'namek$',48,57,59,65,71
endrec db 13,10,'$'
input db 9
count db 0
inchar db 9 p(13),10,'$'
choice db 13,10,'make your choice,please!',13,10,'$'
names db 'name:',13,10,'$'
all db '(0)all:',13,10,'$'
math db '(1)math:',13,10,'$'
chin db '(2)chin:',13,10,'$'
engl db '(3)engl:',13,10,'$'
chem db '(4)chem:',13,10,'$'
phys db '(5)phys:',13,10,'$'
searname db '(1)search name',13,10,'$'
highscore db '(2)search h/l score',13,10,'$'
highs db 'high score is:',13,10,'$'
lows db 'low score is:',13,10,'$'
sear db '(1)search',13,10,'$'
disp db '(2)display',13,10,'$'
noman db 'sorry! nobody have the name here.press ESC back!',13,10,'$'
inname db 'input the name,please:',13,10,'$'
allsubject db 'name math chin engl chem phys argv',13,10,'$'
displist db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
exi db '(ESC)exit',13,10,'$'
datas ends
codes segment
assume cs:codes,ds:datas,ss:stacks
menu: mov ax,datas
mov ds,ax
mov cl,'2'
call displayscore
lea dx,choice
mov ah,9
int 21h
lea dx,sear
int 21h
lea dx,disp
int 21h
lea dx,exi
int 21h
mov ah,1
int 21h
cmp al,31h
jz call1
cmp al,32h
jz call2
cmp al,1bh
jz exit
jmp menu
call1: call search
jmp menu
call2: call displaylist
jmp menu
exit: mov ah,4ch
int 21h
;按成绩排序子程序名:displayscore
;入口参数:cl
;出口参数:无
;功能说明:按照al传递过来的值,进行相应的成绩排序
displayscore proc
push ax
push bx
push cx
push dx
sub cl,2bh
xor ch,ch ;cl中参数传给di(di在程序中不能变)
mov di,cx
mov cx,0100h
circle: mov bl,cl
xor bh,bh
mov si,bx
push di
mov bl,ch
mov di,bx
mov al,displist[si]
mov ah,displist[di]
pop di
push cx
mov cx,ax
lea bx,records ;将al,ah对应的记录偏移地址存入堆栈和bx(cx在程序中也不能变)
mov ax,000bh
mul ch
add bx,ax
push bx
lea bx,records
mov ax,000bh
mul cl
add bx,ax
mov al,cl
xor ah,ah
mov si,ax
mov al,ch
push di
mov di,ax
mov al,displist[si]
xchg al,displist[di]
mov displist[si],al
pop di
smallthan:
inc ch
pp: cmp ch,20
jz outc
jmp circle
outc: inc cl
mov ch,cl
inc ch
cmp cl,20
jz exitdisplayscore
jmp pp
exitdisplayscore:
pop dx
pop cx
pop bx
pop ax
ret
displayscore endp
searchname proc
head: lea dx,inname
mov ah,9
int 21h
lea dx,input
mov ah,10
int 21h
lea dx,inchar
mov ah,9
int 21h
mov cx,0b00h
circle: lea dx,records
mov al,cl
mul ch
add dx,ax
mov bx,dx
mov si,0
p0: mov al,records[bx][si]
mov ah,inchar[si]
cmp records[bx][si],' ' ;records中的结束标志是' '或'$'
jz p4 ;records结束后判断下inchar是否结束
cmp records[bx][si],'$' ;若结束则匹配完毕
jz p4 ;未结束进行下一循环
p1: cmp inchar[si],13
jz p3
p2: cmp ah,al
jz next
p3: inc cl
cmp cl,20
jz exitsearname
jmp circle
p4: cmp inchar[si],13
jz exitsearname
jmp p3
next: inc si
jmp p0
no: lea dx,noman
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,1bh
jz outsear
jmp head
exitsearname:
cmp cl,20
jz no
lea dx,allsubject
mov ah,9
int 21h
call outrecords
outsear: ret
searchname endp
sea proc
lea dx,input
mov ah,10
int 21h
lea dx,inchar
mov ah,9
int 21h
ret
sea endp
searchscore proc
searchsm: mov ah,9
lea dx,choice
int 21h
lea dx,math
int 21h
lea dx,chin
int 21h
lea dx,engl
int 21h
lea dx,chem
int 21h
lea dx,phys
int 21h
lea dx,exi
int 21h
mov ah,2
int 21h
cmp al,1bh
jz exitss
call displayscore
mov cl,0
lea dx,highs
mov ah,9
int 21h
call outrecords
lea dx,highs
mov ah,9
int 21h
mov cl,19
call outrecords
jmp searchsm
exitss: ret
searchscore endp
;全部浏览子程序名:displayall
;入口参数:无
;出口参数:无
;功能说明:将records里面的各条记录按原顺序如实地显示出来
displayall proc
mov cl,0
lea dx,allsubject
mov ah,9
int 21h
lo: push cx
call outrecords
pop cx
inc cl
lea dx,endrec
mov ah,9
int 21h
cmp cl,20
jnz lo
ret
displayall endp
displaylist proc
d: lea dx,choice
mov ah,9
int 21h
lea dx,all
int 21h
lea dx,math
int 21h
lea dx,chin
int 21h
lea dx,engl
int 21h
lea dx,chem
int 21h
lea dx,phys
int 21h
lea dx,exi
int 21h
mov ah,1
int 21h
cmp al,1bh
jz enddl
cmp al,'0'
jl d
jz dall
cmp al,'5'
jg d
mov cl,al
call displayscore
call playaslist
jmp d
dall: call displayall
jmp d
enddl: ret
displaylist endp
playaslist proc
push cx
mov si,0
lea dx,allsubject
mov ah,9
int 21h
loo: mov cl,displist[si]
push si
call outrecords
pop si
inc si
lea dx,endrec
mov ah,9
int 21h
cmp si,20
jnz loo
pop cx
ret
playaslist endp
;
;入口参数:cl
;
outrecords proc
push ax
push bx
push cx
push dx
lea dx,records
mov ch,11
mov al,cl
mul ch
add dx,ax
mov ah,9
int 21h
push dx
mov dl,' '
mov ah,2
int 21h
pop dx
mov si,6
mov cx,0
mov bx,dx
p: mov al,records[bx][si]
xor ah,ah
add cx,ax
call outnum
mov dl,' '
mov ah,2
int 21h
add si,1
cmp si,11
jnz p
mov ax,cx
mov cl,5
div cl
mov ch,ah
call outnum
cmp ch,0
jz exito
mov dl,'.'
mov ah,2
int 21h
mov al,ch
mul ah
mov dl,al
add dl,'0'
mov ah,2
int 21h
exito: pop dx
pop cx
pop bx
pop ax
ret
outrecords endp
;显示数字子程序名:outnum
;入口参数:al
;出口参数:无
;功能说明:输出显示一个<=100的数字
outnum proc
push ax
push bx
push cx
push dx
cmp al,100
jl next1
mov dl,'1'
mov ah,2
int 21h
mov dl,'0'
int 21h
mov dl,'0'
int 21h
jmp exitoutnum
next1: mov ah,0
mov cl,10
div cl
mov dl,al
add dl,'0'
mov ch,ah
mov ah,2
int 21h
mov dl,ch
add dl,'0'
int 21h
exitoutnum:
pop dx
pop cx
pop bx
pop ax
ret
outnum endp
search proc
searmenu: mov ah,9
lea dx,choice
int 21h
lea dx,searname
int 21h
lea dx,highscore
int 21h
lea dx,exi
int 21h
mov ah,1
int 21h
cmp al,31
jz searna
cmp al,32
jz score
cmp al,1bh
jz exitsearch
searna: call searchname
jmp searmenu
score: call searchscore
jmp searmenu
exitsearch: ret
search endp
codes ends
end menu
❷ 200分求用汇编语言做“学生成绩管理”或“带显示界面的运算器”!!!
data segment
mess1 db ' student grade management system',0ah,0dh,'$'
mess2 db ' this is main menu',0ah,0dh,'$'
mess3 db ' insert (i) please input:',0ah,0dh,'$'
mess4 db ' modify (m) name :',0ah,0dh,'$'
mess5 db ' delete (d) maths :',0ah,0dh,'$'
mess6 db ' query (q) english :',0ah,0dh,'$'
mess7 db ' count (c) chinese :',0ah,0dh,'$'
mess8 db ' exit (e)',0ah,0dh,'$'
mess9 db '**********************************************************$'
mess10 db 'name Ma En Co Ch',0ah,0dh,'$'
mess12 db ' list (l)',0ah,0dh,'$'
mess11 db 'maths <60 <70 <80 <90 <100',0ah,0dh,'$'
err1 db ' there is not this student$'
err2 db ' file close wrong$'
fname db "e:\hbyy\score.txt"
buffer1 db 23 p(?)
buffeer db 0ah,0dh,'$'
buffer2 db 30 p(?)
buffer3 db 8 p('0')
count db 5
handle dw ?
del db 8 p('0')
x db ?
data ends
score struc
names db 15 p(' ')
maths db 0,0
english db 0,0
computer db 0,0
chinese db 0,0
score ends
show macro addrs
lea dx,addrs
mov ah,9
int 21h
endm
set_p1 macro a
mov ah,2
mov dh,a
mov dl,36
mov bh,0
int 10h
endm
set_p2 macro
mov ah,2
mov dh,12
mov dl,2
mov bh,0
int 10h
endm
set_p3 macro
mov ah,2
mov dh,1
mov dl,30
mov bh,0
int 10h
endm
clear macro ;all screen
mov al,0
mov cl,0
mov ch,0
mov dh,24
mov dl,79
mov bh,7
mov ah,6
int 21h
endm
clear1 macro ;lefe screen
mov al,0
mov bh,7
mov ch,4
mov cl,36
mov dh,10
mov dl,79
mov ah,6
int 10h
endm
clear2 macro ;down screen
mov al,0
mov bh,7
mov ch,12
mov cl,0
mov dh,24
mov dl,79
int 10h
endm
newline macro
push ax
push dx
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
pop dx
pop ax
endm
show_item macro addrs
local iloop,w10
push bx
push cx
mov bx,0
iloop: mov dl,addrs[bx] ;display char
mov ah,2
int 21h
inc bx
cmp bx,15
jl iloop
mov cx,4
w10: mov dl,' '
mov ah,2
int 21h
mov dl,' '
mov ah,2
int 21h
mov dl,' '
mov ah,2
int 21h
mov dl,addrs[bx]
mov ah,2
int 21h
inc bx
mov dl,addrs[bx]
mov ah,2
int 21h
inc bx
loop w10
newline
pop cx
pop bx
endm
getin macro addrs,count2
local zeroit,lp,input_end,exit
push bx
push ax
mov bx,0
zeroit: mov addrs[bx],' '
inc bx
cmp bx,15
jl zeroit
mov bx,0
lp: mov ah,1
int 21h
cmp al,0ah
jz input_end
cmp al,0dh
jz input_end
mov addrs[bx],al
inc bx
cmp bx,count2
jl lp
input_end: cmp al,0dh
jz exit
cmp al,0ah
jz exit
mov ah,7
int 21h
jmp input_end
exit:
pop ax
pop bx
endm
code segment
main proc far
assume cs:code,ds:data,es:data
start:
mov ax,data
mov ds,ax
mov ah,0
mov al,3
int 10h
clear
show mess1
show mess2
show mess12
show mess3
show mess4
show mess5
show mess6
show mess7
show mess8
newline
show mess9
set_p3
w: mov ah,7
int 21h
cmp al,'i'
jnz n1
call insert
jmp w
n1: cmp al,'m'
jnz n2
call modify
jmp w
n2: cmp al,'d'
jnz n3
call delete
jmp w
n3: cmp al,'q'
jnz n4
call query
jmp w
n4: cmp al,'c'
jnz n5
call cot
jmp w
n5: cmp al,'p'
jnz n6
call print
jmp w
n6: cmp al,'l'
jnz n7
call list
jmp w
n7: cmp al,'e'
jz exitf
jmp w
exitf:
mov ah,4ch
int 21h
ret
main endp
insert proc near
push ax
push bx
push cx
push dx
mov dx,offset fname
mov al,2
mov ah,3dh
int 21h
mov bx,ax
clear1
set_p1 4
call get_rec
mov cx,0 ;move file pointer to end
mov dx,0
mov al,2
mov ah,42h
int 21h
mov cx,23 ;write file
mov dx,offset buffer1
mov ah,40h
int 21h
mov ah,3eh
int 21h
set_p3
pop dx
pop cx
pop bx
pop ax
ret
insert endp
get_rec proc near
push ax
push bx
getin buffer2,15
mov bx,0
mov cx,15
continue: mov al,buffer2[bx]
mov buffer1[bx],al
inc bx
loop continue
set_p1 5
getin buffer2,2
mov al,buffer2
mov buffer1[bx],al
inc bx
mov al,buffer2+1
mov buffer1[bx],al
inc bx
set_p1 6
getin buffer2,2
mov al,buffer2
mov buffer1[bx],al
inc bx
mov al,buffer2+1
mov buffer1[bx],al
inc bx
set_p1 7
getin buffer2,2
mov al,buffer2
mov buffer1[bx],al
inc bx
mov al,buffer2+1
mov buffer1[bx],al
inc bx
set_p1 8
getin buffer2,2
mov al,buffer2
mov buffer1[bx],al
inc bx
mov al,buffer2+1
mov buffer1[bx],al
inc bx
pop bx
pop ax
ret
get_rec endp
openf proc near
mov dx,offset fname
mov al,02
mov ah,3dh
int 21h
mov handle,ax
ret
openf endp
query proc near
push ax
push bx
push cx
push dx
clear1
clear2
mov dx,offset fname
mov al,2
mov ah,3dh
int 21h
mov bx,ax
set_p2
getin buffer1,15
lea dx,mess10
mov ah,9
int 21h
b:
mov ah,3fh
mov cx,23
mov dx,offset buffer2
int 21h
lea si,buffer2
lea di,buffer1
mov cx,15
c:
mov al,byte ptr[si]
cmp al,byte ptr[di]
jnz b
inc si
inc di
loop c
mov [buffer2+23],'$'
show_item buffer2
mov ah,3eh
int 21h
pop dx
pop cx
pop bx
pop ax
ret
query endp
modify proc near
push ax
push bx
push cx
push dx
clear1
set_p1 4
mov dx,offset fname
mov al,2
mov ah,3dh
int 21h
mov bx,ax
mov handle,ax
call get_rec ; contact is in buffer1
read:
mov dx,offset buffer2
mov cx,23
mov ah,3fh
int 21h
lea si,buffer2
lea di,buffer1
mov cx,15
c5:
mov dl,byte ptr[si]
cmp dl,byte ptr[di]
jnz read
inc si
inc di
loop c5
mov bx,handle
mov ah,42h
mov al,1
mov cx,0ffffh
mov dx,-23
int 21h
mov cx,23
mov dx,offset buffer1
mov ah,40h
int 21h
mov ah,3eh
int 21h
jmp exit2
exit1:
set_p2
show err1
exit2:
set_p3
pop dx
pop cx
pop bx
pop ax
ret
modify endp
delete proc near
push ax
push bx
push cx
push dx
clear1
set_p1 4
mov dx,offset fname
mov al,2
mov ah,3dh
int 21h
mov bx,ax
mov handle,ax
getin buffer1,15 ; contact is in buffer1
read5:
mov dx,offset buffer2
mov cx,23
mov ah,3fh
int 21h
lea si,buffer2
lea di,buffer1
mov cx,15
c6:
mov dl,byte ptr[si]
cmp dl,byte ptr[di]
jnz read5
inc si
inc di
loop c6
mov bx,handle
mov ah,42h
mov al,1
mov cx,0ffffh
mov dx,-8
int 21h
mov cx,8
mov dx,offset del
mov ah,40h
int 21h
mov ah,3eh
int 21h
jmp exit6
exit5:
set_p2
show err1
exit6:
set_p3
pop dx
pop cx
pop bx
pop ax
ret
delete endp
list proc near
push ax
push bx
push cx
push dx
clear1
clear2
set_p2
show mess10
mov dx,offset fname
mov al,2
mov ah,3dh
int 21h
mov bx,ax
again:
mov dx,offset buffer1
mov cx,23
mov ah,3fh
int 21h
cmp ax,0
jz p
show_item buffer1
jmp again
p:
mov ah,3eh
int 21h
set_p3
pop dx
pop cx
pop bx
pop ax
ret
list endp
print proc near
push ax
call openf
mov cl,count
mov ch,0
read2:
mov dx,offset buffer1
mov cx,type score
mov ah,3fh
int 21h
mov cx,23h
mov bx,0
next: mov ah,5
mov dl,byte ptr buffer1[bx]
int 21h
inc bx
loop next
mov ah,5
mov dl,0dh
int 21h
dec x
cmp x,0
jnz read2
mov bx,handle
mov ah,3eh
int 21h
pop ax
ret
print endp
cot proc
push ax
clear2
set_p2
show mess11
mov dx,offset fname
mov ah,3dh
int 21h
mov bx,ax
mov handle,ax
read0: mov dx,offset buffer2
mov cx,23
mov ah,3fh
int 21h
mov dl,[buffer2+15]
cmp dl,'6'
jl five
cmp dl,'7'
jl six
cmp dl,'8'
jl seven
cmp dl,'9'
jl eight
inc [buffer3+4]
jmp quit
eight:
inc [buffer3+3]
jmp quit
seven: inc [buffer3+2]
jmp quit
six: inc [buffer3+1]
jmp quit
five: inc [buffer3]
quit: cmp ax,0
jnz read0
mov cx,10
a: mov dl,' '
mov ah,2
int 21h
loop a
mov bx,0
a0: mov dl,[buffer3+bx]
mov ah,2
int 21h
inc bx
mov dl,' '
mov ah,2
int 21h
mov dl,' '
mov ah,2
int 21h
cmp bx,5
jnz a0
mov bx,handle
mov ah,3eh
int 21h
set_p3
pop ax
ret
cot endp
code ends
end start
❸ 用汇编语言编程:学生成绩管理系统
又是伸手党,自己写,不会啊,很简单的。
❹ 学生成绩管理 汇编程序
我这里有程序,在TC系统下可以运行的!也是学生成绩管理系统,你看看行不!
#include<stdio.h>
#include<string.h>
struct student /*ding yi jie gou ti*/
{char num[20];
char name[10];
char sex;
int age;
int chinese;
int math;
int english;
}stu[1000];
int i=0;
int input() /*lu ru xue sheng ji lu*/
{char sign='1',a='1';
system("cls");
printf("\t\t\tPlease lu ru xue sheng ju lu");
while(sign!='n'&&sign!='N')
{printf("\n\t\t\tstudent's num :");
scanf("%s",stu[i].num);
printf("\t\t\tstudent's name :");
scanf("%s",stu[i].name);
gets(a);
printf("\t\t\tstudent's sex ");
printf("\tplease type in (M/W):");
scanf("%c",&stu[i].sex);
printf("\t\t\tstudent's age :");
scanf("%d",&stu[i].age);
printf("\t\t\tstudent's chinese score :");
scanf("%d",&stu[i].chinese);
printf("\t\t\tstudent's mathematics score :");
scanf("%d",&stu[i].math);
printf("\t\t\tstudent's english score :");
scanf("%d",&stu[i].english);
gets(a);
printf("\t\t\tAny more record?(Y/N)");
scanf("%c",&sign);
i++;
}
}
list() /*xian shi suo you ji lu*/
{int j;
system("cls");
printf("\t\tStudents' Grade Management system\n\n");
printf("\n\t-----------------------------------------------------------------\n");
printf("\n\t NUM NAME SEX AGE CHINESE MATH ENGLISH");
for(j=1;j<i+1;j++)
printf("\n\n\t%6s%10s %c %d %d %d %d\n",stu[j-1].num,stu[j-1].name,stu[j-1].sex,stu[j-1].age,stu[j-1].chinese,stu[j-1].math,stu[j-1].english);
printf("\n\n\t-----------------------------------------------------------------\n");
printf("\n\n\t\tPlease input any key to menu!!");
getch();
}
int delete() /*An xing ming san chu*/
{char x[20];
int t=0,j;
int s;
system("cls");
printf("\t-----------------------------------------------------------------\n");
printf("\n\t NUM NAME SEX AGE CHINESE MATH ENGLISH");
for(s=1;s<i+1;s++)
printf("\n\n\t%6s%10s %c %d %d %d %d\n",stu[s-1].num,stu[s-1].name,stu[s-1].sex,stu[s-1].age,stu[s-1].chinese,stu[s-1].math,stu[s-1].english);
printf("\n\n\n\t-----------------------------------------------------------------\n");
printf("\n\n\t\t\tAn xing ming san chu");
printf("\n\n\t\t\t Tell me his(she) name:");
scanf("%s",x);
while(strcmp(stu[t].name,x)!=0&&t<i)
t++;
if(i==t)
printf("\n\t\t\tNot find ! \n");
else for(j=t;j<i;j++)
{strcpy(stu[j].num,stu[j+1].num);
strcpy(stu[j].name,stu[j+1].name);
strcpy(stu[j].sex,stu[j+1].sex);
stu[j].age=stu[j+1].age;
stu[j].chinese=stu[j+1].chinese;
stu[j].math=stu[j+1].math;
stu[j].english=stu[j+1].english;
printf("\n\n\t\t\tDelete successed!\n");
i--;
}
printf("\n\t\tPlease input any key to menu!!");
getch();
}
display() /*An xing ming cha zao,bin xie shi*/
{char x[20];
int t=0,s;
system("cls");
printf("\t\t\tAn xing ming cha zao,bin xie shi\n");
printf("\n\n\t\t\tInput his(she) name:");
scanf("%s",x);
while(strcmp(stu[t].name,x)!=0&&t<i)
t++;
if(i==t)
printf("\n\t\t\tNot find!\n");
else
{printf("\t\tThis is his(she) record:\n");
printf("\n\t\tNumber : %s\n",stu[t].num);
printf("\n\t\tName : %s\n",stu[t].name);
printf("\n\t\tSex : %c\n",stu[t].sex);
printf("\n\t\tAge : %d\n",stu[t].age);
printf("\n\t\tChinese : %d\n",stu[t].chinese);
printf("\n\t\tMath : %d\n",stu[t].math);
printf("\n\t\tEnglish : %d\n",stu[t].english);
}
printf("\n\t\tPlease input any key to menu!!");
getch();
}
score() /*lie chu bu ji ge xue sheng ji lu*/
{int n,x=0;
float m,j;
system("cls");
printf("\t\t\tBu ji ge xue sheng ji lu!\n");
printf("\n\t-----------------------------------------------------------------\n");
printf("\n\t NUM NAME SEX AGE CHINESE MATH ENGLISH");
for(n=0;n<i;n++)
{m=stu[n].chinese+stu[n].math+stu[n].english;
j=m/3;
if(j<60)
{x++;
printf("\n\n\t%6s%10s %c %d %d %d %d\n",stu[n].num,stu[n].name,stu[n].sex,stu[n].age,stu[n].chinese,stu[n].math,stu[n].english);
}
}
printf("\n\n\n\t-----------------------------------------------------------------\n");
if(x==0)
printf("\n\n\n\t\t Mei you bu ji ge de xue sheng ji lu!!");
printf("\n\n\n\t\tPlease input any key to menu!!");
getch();
}
main()
{int n,m=1;
int c;
do
{system("cls");
printf("\n\t\t*******************************************\n\n");
printf("\t\t**** Students' Grade Management system ****\n\n");
printf("\t\t*******************************************");
printf("\n\n\t\t*\t| 1. Input Records | *");
printf("\n\n\t\t*\t| 2. Display All Record | *");
printf("\n\n\t\t*\t| 3. Delete A Record | *");
printf("\n\n\t\t*\t| 4. List a Record | *");
printf("\n\n\t\t*\t| 5. List score<60 Record | *");
printf("\n\n\t\t*\t| 0. Quit | *");
printf("\n\t\t*******************************************\n");
printf("\n\t\t\t Give your choice(0-5):");
scanf("%d",&c);
switch(c)
{ case 1: input();break;
case 2: list();break;
case 3: delete();break;
case 4: display();break;
case 5: score();break;
case 0: m=2;printf("\n\t\tPlease inpit any key to quit!!");getch();break;
default: printf("\t\t\tError\n");
printf("\t\t\tPlease input again!");
getch();
break;
}
}
while(m==1);
}
❺ 如何用汇编语言编写一个学生成绩管理系统
居然要使用汇编语言编写数据库管理系统,肯定可以,但工作量太大,又难免错误百出
即使使用C语言也不如直接用数据库啊
❻ 汇编 学生成绩管理
虽然跟你要求的不是完全一样,不过,作为学生成绩管理系统还是绰绰有余了。本程序可用于浏览、查找(按姓名查找,或按最高/低分查找)。
stacks segment stack
dw 128 p(?)
stacks ends
datas segment
records db 'name1$',100,83,97,94,95
db 'name2$',75,78,98,65,78
db 'name3$',54,87,95,84,95
db 'name4$',87,95,84,65,75
db 'name5$',75,81,82,86,97
db 'name6$',87,98,85,82,90
db 'name7$',51,67,87,54,68
db 'name8$',75,81,91,85,84
db 'name9$',84,87,82,91,73
db 'namea$',72,80,83,81,91
db 'nameb$',87,89,82,90,79
db 'namec$',74,84,80,70,69
db 'named$',84,84,82,99,100
db 'namee$',54,78,89,81,97
db 'namef$',75,84,80,91,90
db 'nameg$',72,81,86,91,89
db 'nameh$',81,82,94,76,70
db 'namei$',42,56,75,61,69
db 'namej$',75,48,84,56,48
db 'namek$',48,57,59,65,71
endrec db 13,10,'$'
input db 9
count db 0
inchar db 9 p(13),10,'$'
choice db 13,10,'make your choice,please!',13,10,'$'
names db 'name:',13,10,'$'
all db '(0)all:',13,10,'$'
math db '(1)math:',13,10,'$'
chin db '(2)chin:',13,10,'$'
engl db '(3)engl:',13,10,'$'
chem db '(4)chem:',13,10,'$'
phys db '(5)phys:',13,10,'$'
searname db '(1)search name',13,10,'$'
highscore db '(2)search h/l score',13,10,'$'
highs db 'high score is:',13,10,'$'
lows db 'low score is:',13,10,'$'
sear db '(1)search',13,10,'$'
disp db '(2)display',13,10,'$'
noman db 'sorry! nobody have the name here.press ESC back!',13,10,'$'
inname db 'input the name,please:',13,10,'$'
allsubject db 'name math chin engl chem phys argv',13,10,'$'
displist db 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
exi db '(ESC)exit',13,10,'$'
datas ends
codes segment
assume cs:codes,ds:datas,ss:stacks
menu: mov ax,datas
mov ds,ax
mov cl,'2'
call displayscore
lea dx,choice
mov ah,9
int 21h
lea dx,sear
int 21h
lea dx,disp
int 21h
lea dx,exi
int 21h
mov ah,1
int 21h
cmp al,31h
jz call1
cmp al,32h
jz call2
cmp al,1bh
jz exit
jmp menu
call1: call search
jmp menu
call2: call displaylist
jmp menu
exit: mov ah,4ch
int 21h
;按成绩排序子程序名:displayscore
;入口参数:cl
;出口参数:无
;功能说明:按照al传递过来的值,进行相应的成绩排序
displayscore proc
push ax
push bx
push cx
push dx
sub cl,2bh
xor ch,ch ;cl中参数传给di(di在程序中不能变)
mov di,cx
mov cx,0100h
circle: mov bl,cl
xor bh,bh
mov si,bx
push di
mov bl,ch
mov di,bx
mov al,displist[si]
mov ah,displist[di]
pop di
push cx
mov cx,ax
lea bx,records ;将al,ah对应的记录偏移地址存入堆栈和bx(cx在程序中也不能变)
mov ax,000bh
mul ch
add bx,ax
push bx
lea bx,records
mov ax,000bh
mul cl
add bx,ax
mov al,cl
xor ah,ah
mov si,ax
mov al,ch
push di
mov di,ax
mov al,displist[si]
xchg al,displist[di]
mov displist[si],al
pop di
smallthan:
inc ch
pp: cmp ch,20
jz outc
jmp circle
outc: inc cl
mov ch,cl
inc ch
cmp cl,20
jz exitdisplayscore
jmp pp
exitdisplayscore:
pop dx
pop cx
pop bx
pop ax
ret
displayscore endp
searchname proc
head: lea dx,inname
mov ah,9
int 21h
lea dx,input
mov ah,10
int 21h
lea dx,inchar
mov ah,9
int 21h
mov cx,0b00h
circle: lea dx,records
mov al,cl
mul ch
add dx,ax
mov bx,dx
mov si,0
p0: mov al,records[bx][si]
mov ah,inchar[si]
cmp records[bx][si],' ' ;records中的结束标志是' '或'$'
jz p4 ;records结束后判断下inchar是否结束
cmp records[bx][si],'$' ;若结束则匹配完毕
jz p4 ;未结束进行下一循环
p1: cmp inchar[si],13
jz p3
p2: cmp ah,al
jz next
p3: inc cl
cmp cl,20
jz exitsearname
jmp circle
p4: cmp inchar[si],13
jz exitsearname
jmp p3
next: inc si
jmp p0
no: lea dx,noman
mov ah,9
int 21h
mov ah,1
int 21h
cmp al,1bh
jz outsear
jmp head
exitsearname:
cmp cl,20
jz no
lea dx,allsubject
mov ah,9
int 21h
call outrecords
outsear: ret
searchname endp
sea proc
lea dx,input
mov ah,10
int 21h
lea dx,inchar
mov ah,9
int 21h
ret
sea endp
searchscore proc
searchsm: mov ah,9
lea dx,choice
int 21h
lea dx,math
int 21h
lea dx,chin
int 21h
lea dx,engl
int 21h
lea dx,chem
int 21h
lea dx,phys
int 21h
lea dx,exi
int 21h
mov ah,2
int 21h
cmp al,1bh
jz exitss
call displayscore
mov cl,0
lea dx,highs
mov ah,9
int 21h
call outrecords
lea dx,highs
mov ah,9
int 21h
mov cl,19
call outrecords
jmp searchsm
exitss: ret
searchscore endp
;全部浏览子程序名:displayall
;入口参数:无
;出口参数:无
;功能说明:将records里面的各条记录按原顺序如实地显示出来
displayall proc
mov cl,0
lea dx,allsubject
mov ah,9
int 21h
lo: push cx
call outrecords
pop cx
inc cl
lea dx,endrec
mov ah,9
int 21h
cmp cl,20
jnz lo
ret
displayall endp
displaylist proc
d: lea dx,choice
mov ah,9
int 21h
lea dx,all
int 21h
lea dx,math
int 21h
lea dx,chin
int 21h
lea dx,engl
int 21h
lea dx,chem
int 21h
lea dx,phys
int 21h
lea dx,exi
int 21h
mov ah,1
int 21h
cmp al,1bh
jz enddl
cmp al,'0'
jl d
jz dall
cmp al,'5'
jg d
mov cl,al
call displayscore
call playaslist
jmp d
dall: call displayall
jmp d
enddl: ret
displaylist endp
playaslist proc
push cx
mov si,0
lea dx,allsubject
mov ah,9
int 21h
loo: mov cl,displist[si]
push si
call outrecords
pop si
inc si
lea dx,endrec
mov ah,9
int 21h
cmp si,20
jnz loo
pop cx
ret
playaslist endp
;
;入口参数:cl
;
outrecords proc
push ax
push bx
push cx
push dx
lea dx,records
mov ch,11
mov al,cl
mul ch
add dx,ax
mov ah,9
int 21h
push dx
mov dl,' '
mov ah,2
int 21h
pop dx
mov si,6
mov cx,0
mov bx,dx
p: mov al,records[bx][si]
xor ah,ah
add cx,ax
call outnum
mov dl,' '
mov ah,2
int 21h
add si,1
cmp si,11
jnz p
mov ax,cx
mov cl,5
div cl
mov ch,ah
call outnum
cmp ch,0
jz exito
mov dl,'.'
mov ah,2
int 21h
mov al,ch
mul ah
mov dl,al
add dl,'0'
mov ah,2
int 21h
exito: pop dx
pop cx
pop bx
pop ax
ret
outrecords endp
;显示数字子程序名:outnum
;入口参数:al
;出口参数:无
;功能说明:输出显示一个<=100的数字
outnum proc
push ax
push bx
push cx
push dx
cmp al,100
jl next1
mov dl,'1'
mov ah,2
int 21h
mov dl,'0'
int 21h
mov dl,'0'
int 21h
jmp exitoutnum
next1: mov ah,0
mov cl,10
div cl
mov dl,al
add dl,'0'
mov ch,ah
mov ah,2
int 21h
mov dl,ch
add dl,'0'
int 21h
exitoutnum:
pop dx
pop cx
pop bx
pop ax
ret
outnum endp
search proc
searmenu: mov ah,9
lea dx,choice
int 21h
lea dx,searname
int 21h
lea dx,highscore
int 21h
lea dx,exi
int 21h
mov ah,1
int 21h
cmp al,31
jz searna
cmp al,32
jz score
cmp al,1bh
jz exitsearch
searna: call searchname
jmp searmenu
score: call searchscore
jmp searmenu
exitsearch: ret
search endp
codes ends
end menu
❼ 用汇编语言编写学生成绩管理系统怎么做
编译的优点是低级别的控制,,写很难用简单的数据库管理系统。
❽ 用汇编语言设计一个学生成绩管理程序
呵呵,我们今年也学汇编了,全班同学的上机报告都是一个版本!!!!
不好理解啊!!!!
❾ 用汇编语言学生成绩管理
参照一下这个程序吧,我也不会 这是一个学生成绩管理系统,其中“I”表示插入,“L”表示浏览,“Q”表示查询, “E”表示退出,“D”表示删除,“M”表示修改,"c"表示统计各分数段人数,"p"表示打印. 本程序实现了: (1)单独运行以上各功能,即在进入主菜单以后,点一功能键后关闭,再进入主菜单 点别的功能键。如运行"cjgl"文件后,在出现的主界面中点“I”,可插入数据,插入完 以后,关闭;在出现的主界面中点“M”,可修改数据,修改完以后关闭,用同样的方法 可运行其它的功能。 (2)连续运行部分的功能。 应将文件"score.txt"放在相应的路径下.如在本程序中,需将该文件放在"c:\masm\score.txt"下. 注:该文件的路径可从汇编源文件的"fname db "c:\masm\score.txt"""中查找. data segment mess1 db ' student grade management system',0ah,0dh,'$' mess2 db ' this is main menu',0ah,0dh,'$' mess3 db ' insert (i) please input:',0ah,0dh,'$' mess4 db ' modify (m) name :',0ah,0dh,'$' mess5 db ' delete (d) maths :',0ah,0dh,'$' mess6 db ' query (q) english :',0ah,0dh,'$' mess7 db ' count (c) computer:',0ah,0dh,'$' mess8 db ' print (p) chinese :',0ah,0dh,'$' mess9 db ' exit (e)',0ah,0dh,'$' mess10 db '**********************************************************$' mess11 db 'name Ma En Co Ch',0ah,0dh,'$' mess13 db ' list (l)',0ah,0dh,'$' mess12 db 'maths <60 <70 <80 <90 <100',0ah,0dh,'$' err1 db ' there is not this student$' err2 db ' file close wrong$' fname db "e:\hbyy\score.txt" buffer1 db 23 p(?) buffeer db 0ah,0dh,'$' buffer2 db 30 p(?) buffer3 db 8 p('0') count db 5 handle dw ? del db 8 p('0') x db ? data ends score struc names db 15 p(' ') maths db 0,0 english db 0,0 computer db 0,0 chinese db 0,0 score ends show macro addrs lea dx,addrs mov ah,9 int 21h endm set_p1 macro a mov ah,2 mov dh,a mov dl,36 mov bh,0 int 10h endm set_p2 macro mov ah,2 mov dh,12 mov dl,2 mov bh,0 int 10h endm set_p3 macro mov ah,2 mov dh,1 mov dl,30 mov bh,0 int 10h endm clear macro ;all screen mov al,0 mov cl,0 mov ch,0 mov dh,24 mov dl,79 mov bh,7 mov ah,6 int 21h endm clear1 macro ;lefe screen mov al,0 mov bh,7 mov ch,4 mov cl,36 mov dh,10 mov dl,79 mov ah,6 int 10h endm clear2 macro ;down screen mov al,0 mov bh,7 mov ch,12 mov cl,0 mov dh,24 mov dl,79 int 10h endm newline macro push ax push dx mov dl,0dh mov ah,2 int 21h mov dl,0ah mov ah,2 int 21h pop dx pop ax endm show_item macro addrs local iloop,w10 push bx push cx mov bx,0 iloop: mov dl,addrs[bx] ;display char mov ah,2 int 21h inc bx cmp bx,15 jl iloop mov cx,4 w10: mov dl,' ' mov ah,2 int 21h mov dl,' ' mov ah,2 int 21h mov dl,' ' mov ah,2 int 21h mov dl,addrs[bx] mov ah,2 int 21h inc bx mov dl,addrs[bx] mov ah,2 int 21h inc bx loop w10 newline pop cx pop bx endm getin macro addrs,count2 local zeroit,lp,input_end,exit push bx push ax mov bx,0 zeroit: mov addrs[bx],' ' inc bx cmp bx,15 jl zeroit mov bx,0 lp: mov ah,1 int 21h cmp al,0ah jz input_end cmp al,0dh jz input_end mov addrs[bx],al inc bx cmp bx,count2 jl lp input_end: cmp al,0dh jz exit cmp al,0ah jz exit mov ah,7 int 21h jmp input_end exit: pop ax pop bx endm code segment main proc far assume cs:code,ds:data,es:data start: mov ax,data mov ds,ax mov ah,0 mov al,3 int 10h clear show mess1 show mess2 show mess13 show mess3 show mess4 show mess5 show mess6 show mess7 show mess8 show mess9 newline show mess10 set_p3 w: mov ah,7 int 21h cmp al,'i' jnz n1 call insert jmp w n1: cmp al,'m' jnz n2 call modify jmp w n2: cmp al,'d' jnz n3 call delete jmp w n3: cmp al,'q' jnz n4 call query jmp w n4: cmp al,'c' jnz n5 call cot jmp w n5: cmp al,'p' jnz n6 call print jmp w n6: cmp al,'l' jnz n7 call list jmp w n7: cmp al,'e' jz exitf jmp w exitf: mov ah,4ch int 21h ret main endp insert proc near push ax push bx push cx push dx mov dx,offset fname mov al,2 mov ah,3dh int 21h mov bx,ax clear1 set_p1 4 call get_rec mov cx,0 ;move file pointer to end mov dx,0 mov al,2 mov ah,42h int 21h mov cx,23 ;write file mov dx,offset buffer1 mov ah,40h int 21h mov ah,3eh int 21h set_p3 pop dx pop cx pop bx pop ax ret insert endp get_rec proc near push ax push bx getin buffer2,15 mov bx,0 mov cx,15 continue: mov al,buffer2[bx] mov buffer1[bx],al inc bx loop continue set_p1 5 getin buffer2,2 mov al,buffer2 mov buffer1[bx],al inc bx mov al,buffer2+1 mov buffer1[bx],al inc bx set_p1 6 getin buffer2,2 mov al,buffer2 mov buffer1[bx],al inc bx mov al,buffer2+1 mov buffer1[bx],al inc bx set_p1 7 getin buffer2,2 mov al,buffer2 mov buffer1[bx],al inc bx mov al,buffer2+1 mov buffer1[bx],al inc bx set_p1 8 getin buffer2,2 mov al,buffer2 mov buffer1[bx],al inc bx mov al,buffer2+1 mov buffer1[bx],al inc bx pop bx pop ax ret get_rec endp openf proc near mov dx,offset fname mov al,02 mov ah,3dh int 21h mov handle,ax ret openf endp query proc near push ax push bx push cx push dx clear1 clear2 mov dx,offset fname mov al,2 mov ah,3dh int 21h mov bx,ax set_p2 getin buffer1,15 lea dx,mess11 mov ah,9 int 21h b: mov ah,3fh mov cx,23 mov dx,offset buffer2 int 21h lea si,buffer2 lea di,buffer1 mov cx,15 c: mov al,byte ptr[si] cmp al,byte ptr[di] jnz b inc si inc di loop c mov [buffer2+23],'$' show_item buffer2 mov ah,3eh int 21h pop dx pop cx pop bx pop ax ret query endp modify proc near push ax push bx push cx push dx clear1 set_p1 4 mov dx,offset fname mov al,2 mov ah,3dh int 21h mov bx,ax mov handle,ax call get_rec ; contact is in buffer1 read: mov dx,offset buffer2 mov cx,23 mov ah,3fh int 21h lea si,buffer2 lea di,buffer1 mov cx,15 c5: mov dl,byte ptr[si] cmp dl,byte ptr[di] jnz read inc si inc di loop c5 mov bx,handle mov ah,42h mov al,1 mov cx,0ffffh mov dx,-23 int 21h mov cx,23 mov dx,offset buffer1 mov ah,40h int 21h mov ah,3eh int 21h jmp exit2 exit1: set_p2 show err1 exit2: set_p3 pop dx pop cx pop bx pop ax ret modify endp delete proc near push ax push bx push cx push dx clear1 set_p1 4 mov dx,offset fname mov al,2 mov ah,3dh int 21h mov bx,ax mov handle,ax getin buffer1,15 ; contact is in buffer1 read5: mov dx,offset buffer2 mov cx,23 mov ah,3fh int 21h lea si,buffer2 lea di,buffer1 mov cx,15 c6: mov dl,byte ptr[si] cmp dl,byte ptr[di] jnz read5 inc si inc di loop c6 mov bx,handle mov ah,42h mov al,1 mov cx,0ffffh mov dx,-8 int 21h mov cx,8 mov dx,offset del mov ah,40h int 21h mov ah,3eh int 21h jmp exit6 exit5: set_p2 show err1 exit6: set_p3 pop dx pop cx pop bx pop ax ret delete endp list proc near push ax push bx push cx push dx clear1 clear2 set_p2 show mess11 mov dx,offset fname mov al,2 mov ah,3dh int 21h mov bx,ax again: mov dx,offset buffer1 mov cx,23 mov ah,3fh int 21h cmp ax,0 jz p show_item buffer1 jmp again p: mov ah,3eh int 21h set_p3 pop dx pop cx pop bx pop ax ret list endp print proc near push ax call openf mov cl,count mov ch,0 read2: mov dx,offset buffer1 mov cx,type score mov ah,3fh int 21h mov cx,23h mov bx,0 next: mov ah,5 mov dl,byte ptr buffer1[bx] int 21h inc bx loop next mov ah,5 mov dl,0dh int 21h dec x cmp x,0 jnz read2 mov bx,handle mov ah,3eh int 21h pop ax ret print endp cot proc push ax clear2 set_p2 show mess12 mov dx,offset fname mov ah,3dh int 21h mov bx,ax mov handle,ax read0: mov dx,offset buffer2 mov cx,23 mov ah,3fh int 21h mov dl,[buffer2+15] cmp dl,'6' jl five cmp dl,'7' jl six cmp dl,'8' jl seven cmp dl,'9' jl eight inc [buffer3+4] jmp quit eight: inc [buffer3+3] jmp quit seven: inc [buffer3+2] jmp quit six: inc [buffer3+1] jmp quit five: inc [buffer3] quit: cmp ax,0 jnz read0 mov cx,10 a: mov dl,' ' mov ah,2 int 21h loop a mov bx,0 a0: mov dl,[buffer3+bx] mov ah,2 int 21h inc bx mov dl,' ' mov ah,2 int 21h mov dl,' ' mov ah,2 int 21h cmp bx,5 jnz a0 mov bx,handle mov ah,3eh int 21h set_p3 pop ax ret cot endp code ends end start
❿ 用汇编语言编写学生成绩管理
汇编 学生成绩管回理答
http://..com/question/43088088.html?si=2