主 题: 我的程序得不到我要的结果,但是不报错
已阅:461 / 回复:3(楼主)
我是个初学者
希望能在论坛上找到解决方法


题目二:  学生成绩管理
功能描述:
1.  输入学生成绩,每个学生的成绩包括学号、姓名(英文字母)、及三门课的成绩,长度自定。为了简单,也可以不从键盘输入数据,直接在数据段定义学生数据即可。
2. 可按姓名对学生成绩记录进行检索。
3. 显示单科有不及格的学生情况。

注意:显示数据程序见参考资料1(沈美明)p161

assume cs:code,ds:data,ss:stack

   data segment

     welcom db 0ah,0dh,0ah,0dh,'       Welcome to use this program',0ah,0dh
            db '             1.Input the mark',0ah,0dh
            db '             2.Search the name',0ah,0dh
            db '             3.Show the fail',0ah,0dh
            db '             4.Exit',0ah,0dh,'$'
     shwcj1 db 0ah,0dh,'  name:','$'
     shwcj2 db 0ah,0dh,'  number:  yuwen:  shuxue:  yingyu:  ','$'
     shwcj3 db 0ah,0dh,'  the fail:',0ah,0dh,'$'
     wrong1 db '   Can not fround the name',0ah,0dh,'$'
     search db '   Input the name',0ah,0dh,'$'
     likef3 db '   Input the marks',0ah,0dh,'$'
     likef1 db '   Like: ',0ah,0dh
            db '         4',0ah,0dh
            db '         qiuyiqun',0ah,0dh,'$'
     likef4 db '   Like: qiuyiqun',0ah,0dh,'$'
     likef2 db '         2008957001 90 90 90',0ah,0dh,'$'
     kyword db 20 dup(' ')
      name1 db 20 dup(' ')
      name2 db 20 dup(' ')
      name3 db 20 dup(' ')
      name4 db 20 dup(' ')
      chji1 db 20 dup(' ')
      chji2 db 20 dup(' ')
      chji3 db 20 dup(' ')
      chji4 db 20 dup(' ')
    
   data ends

   stack segment

      jcqdz db 30,?,30 dup(?)

   stack ends

   code segment

; ------------------------------ 主程序
     main: mov ax,data
           mov ds,ax
           mov ax,stack
           mov ss,ax

    again: mov ax,0
           lea dx,welcom                     ; 输出首语
           mov ah,9
           int 21h

           mov ah,1                          ; 输入选项
           int 21h

           call inpt

           call srch

           call show

           cmp al,'4'                          ; 进入选择4
            je exit

           jmp again                         ; 无条件循环

     exit: mov ax,4c00h
           int 21h

; ------------------------------- 回车换行 cler
     cler proc near
           push ax
           push dx

           mov dl,0dh
           mov ah,2
           int 21h

           mov dl,0ah
           mov ah,2
           int 21h

           pop dx
           pop ax
           ret
     cler endp

; ------------------------------- 输入学生成绩数据 inpt
     inpt proc near
           push ax
           push ds
           push dx

           cmp al,'1'
           jne s1
           call cler
           lea dx,likef3                     ; 输出范例句
           mov ah,9
           int 21h
           lea dx,likef1
           mov ah,9
           int 21h
           lea dx,likef2
           mov ah,9
           int 21h

           mov ah,1
           int 21h
           call cler
           sub al,48
           mov cx,0
           mov cl,al                         ; 最多四组数据
           lea bx,name1
       hh: lea dx,[bx]                       ; 输入名字
           mov ah,10
           int 21h
           call cler
           lea dx,[bx+80]                    ; 输入成绩
           mov ah,10
           int 21h
           call cler
           add bx,20
           loop hh

       s1: pop dx
           pop ds
           pop ax
           ret
     inpt endp

; --------------------------------- 根绝名字查找成绩 srch
     srch proc near
           push ax
           push ds
           push dx
           push bx

           cmp al,'2'
           jne s2
           call cler
           lea dx,search                      ; 提示输入方式
           mov ah,9
           int 21h
           lea dx,likef4
           mov ah,9
           int 21h

           lea dx,kyword                      ; 输入关键字
           mov ah,10
           int 21h

           mov ax,ds
           mov es,ax
           lea si,name1
           mov cx,4                           ; 设置循环变量,查找名字组
       sc: lea di,kyword
           mov dx,16                          ; 设置内循环变量
           mov bx,si
        x: mov al,[si]
           cmp al,[di]
           jne next                           ; 不相等就转跳
           cmp di,16
            je right
           inc si
           inc di
           dec dx
           jnz x

    right: call swjg
           jmp again

     next:
           mov si,[bx+16]                       ; 指向下一个字符串
           loop sc

           lea dx,wrong1                        ; 屏显找不到该名字
           mov ah,9
           int 21h

       s2: pop bx
           pop dx
           pop ds
           pop ax
           ret
     srch endp

; --------------------------------- 显示名字与成绩 swjg
     swjg proc near
           push ax
           push bx
           push dx
           push si

           call cler
           mov ax,0
           lea dx,[shwcj1]
           mov ah,9
           int 21h
           lea dx,[bx]
           mov ah,9
           int 21h
           lea dx,[shwcj2]
           mov ah,9
           int 21h
           lea dx,[bx+80]
           mov ah,9
           int 21h

           pop si
           pop dx
           pop bx
           pop ax
           ret
     swjg endp

; --------------------------------- 显示不及格的成绩 show
     show  proc near
           push dx
           push ax
           push bx
           push si
           push bp

           cmp al,'3'
           jne s3
           call cler
           lea dx,shwcj3
           mov ah,9
           int 21h
           mov bx,11
           mov cx,4
           lea si,chji1
      bjg: mov dx,6
           mov ax,si
        c: mov bp,[si+bx]
           cmp bp,'60'
            jb tt
           add bx,3
           dec dx
           jnz c
           add si,20
           loop bjg

       s3: pop bp
           pop si
           pop bx
           pop ax
           pop dx
           ret
     show endp

       tt: push ax
           push bx
           mov bx,ax
           call swjg
           pop bx
           pop ax
           ret

    code ends

end main

作者:裸奔无罪 (2010-1-10 0:14:56)
回复:我的程序得不到我要的结果,但是不报错
第 1 楼
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reservd.

Assembling: C:\\Documents and Settings\\Administrator\\桌面\\Asm2\\ssglxt.asm
C:\\Documents and Settings\\Administrator\\桌面\\Asm2\\ssglxt.asm(234) : error A2008: syntax error : c
C:\\Documents and Settings\\Administrator\\桌面\\Asm2\\ssglxt.asm(239) : error A2008: syntax error : c
C:\\Documents and Settings\\Administrator\\桌面\\Asm2\\ssglxt.asm(42) : error A2004: symbol type conflict
C:\\Documents and Settings\\Administrator\\桌面\\Asm2\\ssglxt.asm(44) : error A2004: symbol type conflict
C:\\Documents and Settings\\Administrator\\桌面\\Asm2\\ssglxt.asm(261) : warning A4023: with /coff switch, leading underscore required for start address : main
_
Assembly Error

怎么不报错?!

该帖子被1173990124在2010-2-5 14:19:53编辑过
作者:1173990124 (2010-2-5 14:16:39)
回复 1:回复:我的程序得不到我要的结果,但是不报错..
第 2 楼
别用字母c作标号c: mov bp,[si+bx]
           cmp bp,'60'
            jb tt
           add bx,3
           dec dx
           jnz c
把c换成其他字符就不会报错了(我试运行过了)
该帖子被lichao89在2010-2-6 20:02:07编辑过
作者:lichao89 (2010-2-6 20:00:51)
回复:我的程序得不到我要的结果,但是不报错
第 3 楼
Kenilworth (journalists Christian Louboutin Salelearn to row Xu Fei) yesterday morning, in the first half of the economic analysis Council meetings, municipalGhd CPC Committee, Deputy Secretary of municipal partyGhd Hair Straightener Committee, Liu Qi, Mayor, city people's Congress Standing Committee Guo du deyin, city-Tinh, municipal Christian LouboutinCommittee, Deputy Ghd StraightenersSecretary Wang anshun city leadership, expertise and the meeting was attended by representatives of the guest units, promotingGhd Hair Straighteners the development Christian Louboutin Wedding Shoesof science in the capital.
In recentGhd Straighteners Ireland
years, as the capital's economic and social development of strength, the Central enterprises, universities, research christian louboutin very prive  institutions, industry christain louboutin technology Alliance and louboutin wedding shoes the role ofchristian louboutin peep toe  private enterprises increasingly, to accelerate the shift of capital and economic development, promotelouboutin rolando  the industrial structure upgrade instilled greater dynamism and vitality. Beijing attaches great importance to the Christian Shoesdevelopment of these units, special invitations presence of representatives of these units in the first half of the economic situation analysis, and during the Conference held a forum dedicated to listen to everyone in their own development needs and the economic and social development of the capital city of Bruxelles.

Marie Curie
Helen keller
Mitchell Margaret
Emily Bronte
Charlotte Bronte
Anne Bronte
Willa Cather
Jane Austen
Margaret Hilda
Gabriele Munter

个性签名
C
作者:0021111dj (2010-7-28 15:56:43)
当前总数:3 每页50条 当前1/1页 [1 



目前不允许游客回复,请 登录 注册 发贴.