| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 5810 人关注过本帖, 2 人收藏
标题:汇编的数据存储——连百度也百度不到的题
只看楼主 加入收藏
陈CDG
Rank: 2
等 级:论坛游民
帖 子:17
专家分:57
注 册:2016-4-11
结帖率:0
收藏(2)
已结贴  问题点数:20 回复次数:3 
汇编的数据存储——连百度也百度不到的题
实验八  80x86汇编语言程序综合设计
设计一个功能完善的学生成绩管理系统,每个学生成绩按下面的标准格式保存:
姓名(汉语拼音)    学号(6位数字)        专业(拼音)    语言成绩    数学成绩    英语成绩
1)管理系统要求使用密码登录;初始密码设置为你学号的后6位数字,登录后管理员可以修改密码;密码以加密形式保存;(20%)
2)系统要求提供一下的功能:
(1)显示功能:显示系统中所有学生的信息;(10%)
(2)数据录入功能:在系统中增加新学生的信息;(10%)
(3)删除功能:可以根据给定的学号将学号指定的学生的信息删除;(10%)
(4)查询功能:可以使用学号、姓名查询学生的信息,并将查询的信息显示;(20%)
(5)统计功能:按照各科成绩先高后低的顺序输出全部学生的排名;计算输出各科成绩的平均分;各名学生的平均分;(20%)
(6)程序要求菜单控制;程序能够处理基本的错误信息;退出系统的功能键是ESC键;(10%)
我写了一部分,就没有然后了求高手帮忙完善下,谢谢!!
Student struc
    sname     db  20 dup(?)
    studentid    db 7 dup(?)
     major    db  20 dup(?)
     Chinese  db  0
     Math     db  0
    English   db  0
student ends
data segment
s    student   20 dup(<>)
string0    db 13,10,'enter anything to continue','$'
string1    db 'please input 6 bit password: ',13,10,'$'
string2    db 'succeed in entering password',13,10,'$'
string3    db 'error,please input 6 bit password again: ',13,10,'$'
string4    db 'Please select the required function: ',13,10,'$'
string5    db 'A.Display function: display the information of all the students in the system',13,10,'$'
string6    db 'B.Data entry function:increase the information of new students in the system',13,10,'$'
string7    db 'C.Delete function: according to the student ID delete information of the student',13,10,'$'
string8    db 'D.Query function: you can use the student ID, name ',13,10,'query student information, and display',13,10,'$'
string9    db 'E.Statistics function: from high to low order output rankings',13,10,'of all students in all subjects;calculation average of subjects;',13,10,'each student average score',13,10,'$'
stringa    db 'F.Modify administrator password',13,10,'$'
stringb    db 'Please enter the function options management system (press ESC to exit the system): ',13,10,'$'
stringc    db 'please enter name of the student: ',13,10,'$'
stringd    db 'please enter studentid of the student: ',13,10,'$'
stringe    db 'please enter the major: ',13,10,'$'
stringf    db 'please enter the score of Chinese: ',13,10,'$'
string10   db 'please enter the score of Math: ',13,10,'$'
string11   db 'please enter the score of English: ',13,10,'$'
string12   db 'neme     studentid   major   Chinese  Math   English',13,10,'$'
string13   db 'please enter 6 bit new password: ',13,10,'$'
string14   db 'succeed in entering new password',13,10,'$'
string15   db 'please emter System again!',13,10,'$'

password   db '1','2','0','2','4','8',13
pwtemp     db '1','2','0','2','4','8',13
n          dw ?
function   db ?
i          db 10
j          db 0
k          dw 0
number     db 0
strc       db ?
data ends

code segment
assume    cs:code,ds:data

start:
    mov ax,data
    mov ds,ax
   
print macro string         ;定义输出字符串的宏
   lea dx,string
    mov ah,9
    int 21h
    endm

printf macro variable
    mov al,variable
    .if al<=9
        add al,30h
        mov ah,02h
        mov dl,al
        int 21h
    .endif
    mov al,variable
    .if al>9
        mov ah,0
        mov cx,0
        mov dl,10
       .while al>9
        div dl
        mov bx,0
        mov bl,ah
        push bx
        inc cx
       .endw
       mov ah,02h
       add al,30h
       mov dl,al
       int 21h
      
      .if cx>0
      pop dx
      add dl,30h
      int 21h
      dec cx
      .endif
   .endif   
  endm  

 printfc macro variable
    mov ah,02h
    mov dl,variable
    int 21h
 
   endm

scanfc macro variable
       mov ah,01h
       int 21h
       mov variable,al         
    endm

scanfd macro variable
         mov cx,0
         mov ax,0
        .while al!=13            
          mov ah,01h
          int 21h
          .if al!=13
          mov bl,al
          sub bl,30h
         
          mov bh,0
          push bx
          inc cx
          .endif
        .endw        
          mov dh,10
          mov dl,1
        .while cx>0  
          pop  bx
          mov al,bl
          mul dl
          add variable,al
         
          mov al,dl
          mul dh
          mov dl,al         
         dec cx
       .endw
      
        endm
        
hchh macro
     mov ah,02h
    mov dl,13
    int 21h
    mov dl,10
    int 21h
   
    endm
   
kg macro
   mov ah,02h
   mov dl,' '
   int 21h
   mov dl,' '
   int 21h
   endm
sysytementer:
    print string1           ;提示1,输入管理员密码
   
   
    mov cx,7                 ;设置7次循环输入密码
    lea bx,pwtemp            ;设置指针保存临时密码
input:   
    mov ah,08h                ;调用输入
    int 21h
   
    mov [bx],al                ;保存临时密码
    cmp al,13                  ;判断是否输入了回车
    je next                     ;输入回车则结束输入
   
    mov ah,2                   ;将输入的密码以*号显示
    mov dl,'*'
    int 21h
     
   
    inc bx                     ;指针偏移
   
    loop input                    ;循环输入
next:
    ;密码正误判断处理
    lea si,pwtemp               ;指针指向临时密码的保存位置
    lea bx,password              ;指针指向原密码的保存位置
    mov cx,7                     ;设置循环次数
testpassword:                 
   mov al,[si]                  ;取出两个密码作比较
   mov ah,[bx]
   cmp al,ah
   je next2                     ;相等则继续比较至结束
   
    print string3               ;否则提示密码错误重新输入
   
    mov n,0
    lea bx,pwtemp               ;重新设置指针,重新输入
    inpw_again:               
       mov ah,08h
        int 21h
        
        mov [bx],al
        cmp al,13
        je next                  ;输入结束后再次跳转至判断部分
        
        mov ah,2
        mov dl,'*'
        int 21h
         
        inc bx
        inc n
       cmp n,7
       jb inpw_again
   
next2:
   inc si
   inc bx
   loop testpassword           ;当判断出密码完全正确才结束密码输入部分
   

   print string2               ;提示密码输入正确
   
systemfunction:   print string4
   print string5
   print string6
   print string7
   print string8
   print string9
   print stringa
   print stringb
   
    ;选择功能
    scanfc function
    .if function==27
         jmp exitsystem
         
    .endif
    ;录入
    .if function=='B'   
        scanfc strc
        hchh
        ;输入姓名
         print stringc         
         lea bx,s.sname
         mov ax,0
      .while al!=13
          scanfc [bx]
          inc bx
          .endw
         
      hchh   
      ;输入学号
       print stringd      
       lea bx,s.studentid
       mov ax,0
      .while al!=13
          scanfc [bx]
          inc bx
      .endw
      
  hchh
      ;输入专业
      print stringe        
      lea bx,s.major
      mov ax,0
      .while al!=13
       scanfc [bx]
          inc bx
      .endw
      
    hchh
      ;输入语文
      print stringf      
      scanfd s.Chinese      
    hchh
      ;输入数学
      print string10
     scanfd s.Math
   hchh
     ;输入英语
     print string11
     scanfd s.English
    hchh
    .endif
  ;显示
   .if function=='A'
      scanfc strc
      hchh
      ;显示输出的格式
      print string12
      hchh
      ;显示姓名
       lea bx,s.sname
       mov dx,0
      .while dl!=13
      printfc [bx]
      inc bx
      .endw      
      hchh
      ;显示学号
      lea bx,s.studentid
      mov dx,0
      .while dl!=13
      printfc [bx]
      inc bx
      .endw     
      hchh
      ;显示专业
      lea bx,s.major
      mov dx,0
      .while dl!=13
      printfc [bx]
      inc bx
      .endw
      hchh
      ;显示语文
      printf s.Chinese
      kg
       ;显示数学
      printf s.Math
      kg
      ;显示英语
      printf s.English
      hchh
           
   .endif
   ;修改密码
  .if function=='F'
     scanfc strc
        hchh
     print string13
     mov ax,0
     
         mov cx,7                 ;设置7次循环输入密码
            lea bx,password            ;设置指针保存临时密码
        input2:   
            mov ah,08h                ;调用输入
            int 21h
            
            mov [bx],al                ;保存临时密码
            cmp al,13                  ;判断是否输入了回车
            je next3                    ;输入回车则结束输入
            
            mov ah,2                   ;将输入的密码以*号显示
            mov dl,'*'
            int 21h            
            inc bx                     ;指针偏        
            loop input2                    ;循环输入
next3:   
   print   string14   
   print   string15
   jmp sysytementer
  .endif
    hchh
    jmp  systemfunction
exitsystem:   
    lea dx,string0
    mov ah,9
    int 21h
    ;暂停,任意键关闭
    mov ah,1
    int 21h
    mov ah,4ch     ;结束,可以修改al设置返回码
    int 21h
   
   
code ends
    end start
搜索更多相关主题的帖子: 修改密码 汉语拼音 英语成绩 管理系统 百度 
2016-06-25 23:05
Valenciax
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:11
帖 子:340
专家分:2482
注 册:2016-5-15
收藏
得分:20 
是楼主写的吗?功底不错,有什么要改善呢?

嗯,画面显示比较混乱,一堆英文在上面,分不出要按什么?
可以齐整一些比如,把表单简化,利用方向键上下选择,
然后随着选择,相关的提示即时在在最下方显示。
这就要用到int16读方向键的扫瞄码,int 10h关于光标位置的移动,隐藏和显示等功能。

> A.Display Record
  B.Input Record
  C.Delete Record
  D.Query Record
  E.Statistics
  F.Change Password

Choose:A



Display the information of all the students in the system.




至于存取资料,要动用int 21h,AH:3CH(建立),3DH(开启),3FH(读取),42H(移动档案指标)等函数,DX指向位置,BX是句柄,CX是长度等等,不明白的百度,或者再提问吧。

[此贴子已经被作者于2016-6-26 07:39编辑过]

2016-06-26 07:20
陈CDG
Rank: 2
等 级:论坛游民
帖 子:17
专家分:57
注 册:2016-4-11
收藏
得分:0 
已解决,多谢
2016-07-16 00:45
春正正
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2017-6-19
收藏
得分:0 
我想要一下这段代码的注释,我看不懂。可以么?谢谢、



print macro string         ;定义输出字符串的宏
   lea dx,string
     mov ah,9
     int 21h
     endm

 printf macro variable
     mov al,variable
     .if al<=9
         add al,30h
         mov ah,02h
         mov dl,al
         int 21h
     .endif
     mov al,variable
     .if al>9
         mov ah,0
         mov cx,0
         mov dl,10
        .while al>9
         div dl
         mov bx,0
         mov bl,ah
         push bx
         inc cx
        .endw
        mov ah,02h
        add al,30h
        mov dl,al
        int 21h
        
       .if cx>0
       pop dx
       add dl,30h
       int 21h
       dec cx
       .endif
    .endif   
   endm  

  printfc macro variable
     mov ah,02h
     mov dl,variable
     int 21h
  
    endm

 scanfc macro variable
        mov ah,01h
        int 21h
        mov variable,al         
     endm

 scanfd macro variable
          mov cx,0
          mov ax,0
         .while al!=13            
           mov ah,01h
           int 21h
           .if al!=13
           mov bl,al
           sub bl,30h
           
           mov bh,0
           push bx
           inc cx
           .endif
         .endw        
           mov dh,10
           mov dl,1
         .while cx>0  
           pop  bx
           mov al,bl
           mul dl
           add variable,al
           
           mov al,dl
           mul dh
           mov dl,al         
          dec cx
        .endw
        
         endm
         
 hchh macro
      mov ah,02h
     mov dl,13
     int 21h
     mov dl,10
     int 21h
     
     endm
     
 kg macro
    mov ah,02h
    mov dl,' '
    int 21h
    mov dl,' '
    int 21h
    endm
 sysytementer:
2017-06-19 22:02
快速回复:汇编的数据存储——连百度也百度不到的题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021986 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved