匯編學生成績管理
❶ 用匯編編寫,學生成績管理系統
轉帖的:
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