彙編中結構體示例

2021-03-04 01:00:18 字數 4157 閱讀 9641

實驗內容

學生成績管理系統

資料輸出格式:

學號姓名數學英語彙編總分

實驗要求

給出本題目的設計方案,程式設計的流程圖,操

作步驟,實施辦法。

2、每個學生的姓名、各門學習成績由鍵盤輸入並完成相應的資料轉換操作(鍵盤輸入操作應有文字提示)。

3、計算每個學生的總分成績,填入相應的儲存單元。

4、按照總分成績進行排序(從高到低)。

5、按照規定格式進行資料輸出顯示操作。

6、本課題的資料採集至少在5人以上的資料。

7、給出除錯通過的程式清單,並附文件說明書。

8、給出除錯中所遇到的問題及解決辦法和體會。

**為:

crlf macro

mov dl,13

mov ah,02h

int 21h

mov dl,10

int 21h

endm

student struc

number db 9 dup('$')

names db 9 dup('$')

maths dw ?

english dw ?

assemble dw ?

total dw 0

student ends

data segment

stu_array student 10 dup(<>) ;開闢10個學生資訊的空間

menu db 13,10,13,10,13,10,13,10,13,10

dbmain menu13,10

db1.create the information of students',13,10

db2.figure out the total scores',13,10

db3.rank the datas' ,13,10

db4.display the information' ,13,10

db5.exit',13,10

db13,10

dbplease input your chioce:$'

point_infor db 0dh,0ah,'please press any key to continue';'請按任意鍵繼續';

input_num db 'please input the number of students: $'

input_infor db 'num name maths english assemble',0dh,0ah,'$'

add_infor db "the total of student's scores is ***pleted",0dh,0ah,'$'

rank_infor db "ranking the student's scores is ***pleted",0dh,0ah,'$'

disp_infor db 'num name maths english assemble total',0dh,0ah,'$'

chioce dw ?

num dw ?

data ends

program segment

assume cs:program,ds:data

start:

push ds ;儲存舊資料段

sub ax,ax

push ax

mov ax,data ;設定新資料段

mov ds,ax

main_menu:

mov ax,0003h ;清屏

int 10h

lea dx,menu ;輸出主選單

mov ah,09h

int 21h

lea di,chioce ;接收選擇

call input

cmp chioce,1h ;根據選擇判斷跳轉

jz create

cmp chioce,2h

jz figure

cmp chioce,3h

jz rank

cmp chioce,4h

jz disp

cmp chioce,5h

jz exit0

jmp main_menu

輸入create:

call setdata

jmp main_menu

連加figure:

call figure_total

jmp main_menu

排序rank:

call arrange

jmp main_menu

顯示disp:

call display_infor

jmp main_menu

退出exit0:

mov ah,4ch

int 21h

輸入資料子程式

input proc near

mov bx,0

mov word ptr[di],0

newchar:

mov ah,1h

int 21h

sub al,30h

jl exit

cmp al,10

jnl exit

inc bx

cbwxchg ax,word ptr[di]

mov cx,10

mul cx

xchg ax,word ptr[di]

add word ptr[di],ax

jmp newchar

exit:

mov cx,6h

sub bx,cx

sk: mov dl,' '

mov ah,2

int 21h

loop sk

retinput endp

讀入學號和姓名子程式

input_word proc near ;

mov cx,8

new_word:

mov ah,1

int 21h

mov byte ptr [di],al

cmp al

jz next1

inc di

loop new_word

next1:

dec cx ;cx=cx-1

next2:

inc di ;di=di+1

mov dlshow ' '

mov ah,02h

int 21h

mov al

mov byte ptr [di],al

loop next2

retinput_word endp

顯示字串子程式

displ proc near

push ax

push dx

mov ah,9

mov dx,di

int 21h

pop dx

pop ax

retdispl endp

以十進位制輸出子程式

output proc near

mov bx,10

mov cx,0

last:

mov dx,0

div bx

push dx

inc cx

cmp ax,0

jnz last

mov bx,8h

sub bx,cx

ag:pop dx

add dl,30h

mov ah,2

int 21h

loop ag

mov cx,bx

sh: mov dl,' '

結構體變數和結構體陣列

第一套1 程式填空題 在被調函式中修改並輸出結構體變數的值 程式通過定義學生結構體變數,儲存了學生的學號 姓名和3門課的成績。函式fun的功能是將形參a所指結構體變數中的資料賦給函式中的結構體變數b,並修改b中的學號和姓名,最後輸出修改後的資料。例如 a所指變數中的學號 姓名 和三門課的成績依次是 ...

基礎數字彙編編寫方法及示例

一 基礎數字彙編的編寫 一 基礎數字彙編的概念 特點和作用 1 概念 基礎數字彙編是以數量特徵反映乙個地區 機構 行業 基本情況的一種檔案參考資料。又稱統計基礎數字匯集 基本情況統計。它是對檔案材料中原有的統計數字的摘錄 綜合 彙總。2 基礎數字彙編的特點是 內容集中 形式靈活 利用方便。3 它有以...

C語言6 結構體,共用體

選票統計 time limit 1000ms memory limit 65536k 題目描述 某校學生會主席由全校學生投票選舉產生,共有 名候選人報名參選,編號為1到 0 1000 全校有 名學生 0 30000 每人都可以投票。但每人只能投一票,每票只能選1名候選人。請你設計乙個程式能夠統計出哪...