从键盘输入一串字符,分别统计其中的字母,数字字符和其他
汇编编程:从键盘输入一串字符,分别统计其中的字母(不区分大小写)、数字字符和其他
键盘输入一串字符,统计出其中的数字字符个数,字母字符(不区分大小写)个数,其他字符个数,并显示出这三类统计结果(输入字符串以回车结束),可连续对多个字符串统计,用户输入N时退出程序。
要求:
目
(如何实现,以及实现的关键技术或步骤)
2.要有
图
3.写出程序代码
4.写出上机操作步骤,给出输入的数据及程序运行结果。
; 题目名称:分类统计字符
; 题目来源:
; 本程序在MASMPlus 1.2集成环境下通过编译,经过调试,运行正确。 Code Segment
Assume CS:Code,DS:Code
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ; 功能:显示指定地址(Str_Addr)的字符串
; 入口:
; Str_Addr,字符串地址(要求在数据段)
; 用法: Output Str_Addr
; 用法举例:Output PromptStr
Output MACRO Str_Addr
lea dx,Str_Addr
mov ah,9
int 21h
EndM
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ; 功能:在当前光标位置显示一个字符
; 入口:dl=要显示的字符
Output_Chr proc Near
push ax
mov ah,02h
int 21h
pop ax
ret
Output_Chr Endp
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ; 功能:显示、输出一个回车、换行
Output_CTLF proc Near
push ax
push dx
mov ah,02h
mov dl,0dh
6.2.6 establishing construction site welding secondary, secondary electrode consisted of Rod piled up, welding rod ovens, incubators, thermometers, hygrometers and backing of electrodes, receiving, payment and recovery system. And person responsible for the secondary database. 6.2.7 construction welding machines, grinding machines, plasma cutting machine tool experience is qualified. 6.2.8 welding electrodes, welding wire selection in line with national and industry standards requirements, welding material welding materials quality manual should be provided, its chemical composition, mechanical properties and other indicators should conform to the requirements of the relevant standards, appearance may not have defects such as corrosion, unqualified products cannot be used. 6.2.9 electrode, flux drying before use according to the regulations, and should be kept dry during use, wires should be removed before using the surface oil, rust, etc. Electrodes must not fall off, no rust spots and obvious cracks. 6.3 6.3.1 electrode electrode selection and management list trumpeter argon arc welding electrode arc welding of steel 10# E4303 J427 H08Mn2SiA 20# E4303 J427 H08Mn2SiA Q235-A E4303 J422, H08Mn2SiA 304 E308 A102 H0Cr21Ni10 316L E00-19 A002 H00Cr21Ni10 321 E347 A137 H0Cr21Ni10Ti 1 5Cr ... (2) the purity of argon carbon steel and alloy steel pipe shall not be less than 99.9%. (3) the welding field wind-proof, rain-proof measures must be taken, when the relative humidity is greater than 90%, when the wind speed is greater than 2m/s, do not allow application of argon arc welding, when the wind speed is greater than 8M/s, do not allow the application of arc welding. Welding shall not be less than 0 ? ambient temperature. (4) prior to welding, you should review the lip size, meet the requirements before they
int 21h
mov dl,0ah
int 21h
pop dx
pop ax
ret
Output_CTLF Endp
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
; 功能:把AX中的二进制无符号数转换成显式的十进制ASCII码,并送显示屏显示
; 入口:AX=二进制数
; 出口:在当前光标位置显示转换后的ASCII码数字 Unsi_Dec_ASCII Proc Near
push dx
push bx
push di
mov bx,10
lea di,@@Temp_Save[5]
mov BYTE PTR [di],'$'
dec di
cld
@@Divide: xor dx,dx
div bx
or dl,30h
mov [di],dl
dec di
test ax,ax
jnz @@Divide
inc di
push di
pop dx
mov ah,9
int 21h
pop di
pop bx
pop dx
ret
@@Temp_Save db 6 dup(?) Unsi_Dec_ASCII EndP
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
; 功能:键盘输入一个字符,若输入的是'y'或'n'(不分大小写),则显示并返回
; 入口:无
; 出口:若输入的是'y',进位标志置位;若输入的是'n',进位标志复位。 Yes_or_No proc Near
push dx
6.2.6 establishing construction site welding secondary, secondary electrode consisted of Rod piled up, welding rod ovens, incubators, thermometers, hygrometers and backing of electrodes, receiving, payment and recovery system. And person responsible for the secondary database. 6.2.7 construction welding machines, grinding machines, plasma cutting machine tool experience is qualified. 6.2.8 welding electrodes, welding wire selection in line with national and industry standards requirements, welding material welding materials quality manual should be provided, its chemical composition, mechanical properties and other indicators should conform to the requirements of the relevant standards, appearance may not have defects such as corrosion, unqualified products cannot be used. 6.2.9 electrode, flux drying before use according to the regulations, and should be kept dry during use, wires should be removed before using the surface oil, rust, etc. Electrodes must not fall off, no rust spots and obvious cracks. 6.3 6.3.1 electrode electrode selection and management list trumpeter argon arc welding electrode arc welding of steel 10# E4303 J427 H08Mn2SiA 20# E4303 J427 H08Mn2SiA Q235-A E4303 J422, H08Mn2SiA 304 E308 A102 H0Cr21Ni10 316L E00-19 A002 H00Cr21Ni10 321 E347 A137 H0Cr21Ni10Ti 1 5Cr ... (2) the purity of argon carbon steel and alloy steel pipe shall not be less than 99.9%. (3) the welding field wind-proof, rain-proof measures must be taken, when the relative humidity is greater than 90%, when the wind speed is greater than 2m/s, do not allow application of argon arc welding, when the wind speed is greater than 8M/s, do not allow the application of arc welding. Welding shall not be less than 0 ? ambient temperature. (4) prior to welding, you should review the lip size, meet the requirements before they
push ax
@@Input_Chr: mov ah,7 ;不带回显的键盘输入
int 21h
mov dl,al
and al,0dfh
cmp al,'Y'
jnz $+5
stc
jmp $+7
cmp al,'N'
jnz @@Input_Chr
clc
mov ah,2
int 21h
pop ax
pop dx
ret
Yes_or_No Endp
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Letters dw ? ;字母个数
Dights dw ? ;数字个数
Others dw ? ;其它字符个数
Letters_sum db 13,10,'Letters: $' Dights_sum db 13,10,'Digits : $' Others_sum db 13,10,'Others : $' Prompt_Str db 'Please input a string:$' Prompt_Con db 13,10,13,10,'Continue(Y/N)?$'
Press_Key db 7,13,10,13,10,'The complated. Press any key to exit...$'
Start: push cs
pop ds
push cs
pop es
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ; 从键盘上连续输入一串字符(字符个数不超过80个,该字符串用回车符结束) Input_Str: Output Prompt_Str ;提示输入一串字符
lea dx,Buffer ;输入字符串缓冲区地址
mov ah,0ah ;从键盘接收字符串
int 21h
call Output_CTLF ;输出一个回车、换行
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ; 按字母、数字、其它字符分类统计计数
lea si,Buffer[1] ;实际输入的字符数地址
lodsb ;读入实际输入的字符数
xor ah,ah
6.2.6 establishing construction site welding secondary, secondary electrode consisted of Rod piled up, welding rod ovens, incubators, thermometers, hygrometers and backing of electrodes, receiving, payment and recovery system. And person responsible for the secondary database. 6.2.7 construction welding machines, grinding machines, plasma cutting machine tool experience is qualified. 6.2.8 welding electrodes, welding wire selection in line with national and industry standards requirements, welding material welding materials quality manual should be provided, its chemical composition, mechanical properties and other indicators should conform to the requirements of the relevant standards, appearance may not have defects such as corrosion, unqualified products cannot be used. 6.2.9 electrode, flux drying before use according to the regulations, and should be kept dry during use, wires should be removed before using the surface oil, rust, etc. Electrodes must not fall off, no rust spots and obvious cracks. 6.3 6.3.1 electrode electrode selection and management list trumpeter argon arc welding electrode arc welding of steel 10# E4303 J427 H08Mn2SiA 20# E4303 J427 H08Mn2SiA Q235-A E4303 J422, H08Mn2SiA 304 E308 A102 H0Cr21Ni10 316L E00-19 A002 H00Cr21Ni10 321 E347 A137 H0Cr21Ni10Ti 1 5Cr ... (2) the purity of argon carbon steel and alloy steel pipe shall not be less than 99.9%. (3) the welding field wind-proof, rain-proof measures must be taken, when the relative humidity is greater than 90%, when the wind speed is greater than 2m/s, do not allow application of argon arc welding, when the wind speed is greater than 8M/s, do not allow the application of arc welding. Welding shall not be less than 0 ? ambient temperature. (4) prior to welding, you should review the lip size, meet the requirements before they
mov cx,ax ;实际输入的字符数送计数器
jcxz Continue
mov Letters,0 ;字母计数单元清零
mov Dights,0 ;数字计数单元清零
mov Others,0 ;其它字符计数单元清零 Classify: lodsb ;当前字符?AL
cmp al,'0' ;当前字符<'0'?
jb Other_Chr ;小于,转去按其它字符处理
cmp al,'9' ;当前字符>'9'?
ja $+8 ;大于,转去判断是否字母
inc Dights ;数字计数
jmp Other_Chr[4]
mov ah,al ;al?ah,用于判断是否字母
and ah,0dfh ;屏蔽第5位,按大写字母处理
cmp ah,'A' ;当前字符<'A'?
jb Other_Chr ;小于,转去按其它字符处理
cmp ah,'Z' ;当前字符>'Z'?
ja Other_Chr ;大于,转去按其它字符处理
inc Letters ;字母计数
jmp $+6
Other_Chr: inc Others ;其它字符计数
loop Classify
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
; 显示分类统计结果
Output Letters_sum
mov ax,Letters ;字母个数
call Unsi_Dec_ASCII ;把AX中的二进制无符号数转换成显式的十进制ASCII码,并送
显示屏显示
Output Dights_sum
mov ax,Dights ;数字个数
call Unsi_Dec_ASCII
Output Others_sum
mov ax,Others ;其它字符个数
call Unsi_Dec_ASCII Continue: Output Prompt_Con
call Yes_or_No
jnc Exit_Proc
call Output_CTLF
call Output_CTLF
jmp Input_Str
; ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
Exit_Proc: Output Press_Key ;提示操作完成,按任意键结束程序
mov ah,1
int 21h
6.2.6 establishing construction site welding secondary, secondary electrode consisted of Rod piled up, welding rod ovens, incubators, thermometers, hygrometers and backing of electrodes, receiving, payment and recovery system. And person responsible for the secondary database. 6.2.7 construction welding machines, grinding machines, plasma cutting machine tool experience is qualified. 6.2.8 welding electrodes, welding wire selection in line with national and industry standards requirements, welding material welding materials quality manual should be provided, its chemical composition, mechanical properties and other indicators should conform to the requirements of the relevant standards, appearance may not have defects such as corrosion, unqualified products cannot be used. 6.2.9 electrode, flux drying before use according to the regulations, and should be kept dry during use, wires should be removed before using the surface oil, rust, etc. Electrodes must not fall off, no rust spots and obvious cracks. 6.3 6.3.1 electrode electrode selection and management list trumpeter argon arc welding electrode arc welding of steel 10# E4303 J427 H08Mn2SiA 20# E4303 J427 H08Mn2SiA Q235-A E4303 J422, H08Mn2SiA 304 E308 A102 H0Cr21Ni10 316L E00-19 A002 H00Cr21Ni10 321 E347 A137 H0Cr21Ni10Ti 1 5Cr ... (2) the purity of argon carbon steel and alloy steel pipe shall not be less than 99.9%. (3) the welding field wind-proof, rain-proof measures must be taken, when the relative humidity is greater than 90%, when the wind speed is greater than 2m/s, do not allow application of argon arc welding, when the wind speed is greater than 8M/s, do not allow the application of arc welding. Welding shall not be less than 0 ? ambient temperature. (4) prior to welding, you should review the lip size, meet the requirements before they
mov ah,4ch ;结束程序
int 21h
Buffer db 80 ;字符串缓冲区
Code Ends
END Start ;编译到此结束
6.2.6 establishing construction site welding secondary, secondary electrode consisted of Rod piled up, welding rod ovens, incubators, thermometers, hygrometers and backing of electrodes, receiving, payment and recovery system. And person responsible for the secondary database. 6.2.7 construction welding machines, grinding machines, plasma cutting machine tool experience is qualified. 6.2.8 welding electrodes, welding wire selection in line with national and industry standards requirements, welding material welding materials quality manual should be provided, its chemical composition, mechanical properties and other indicators should conform to the requirements of the relevant standards, appearance may not have defects such as corrosion, unqualified products cannot be used. 6.2.9 electrode, flux drying before use according to the regulations, and should be kept dry during use, wires should be removed before using the surface oil, rust, etc. Electrodes must not fall off, no rust spots and obvious cracks. 6.3 6.3.1 electrode electrode selection and management list trumpeter argon arc welding electrode arc welding of steel 10# E4303 J427 H08Mn2SiA 20# E4303 J427 H08Mn2SiA Q235-A E4303 J422, H08Mn2SiA 304 E308 A102 H0Cr21Ni10 316L E00-19 A002 H00Cr21Ni10 321 E347 A137 H0Cr21Ni10Ti 1 5Cr ... (2) the purity of argon carbon steel and alloy steel pipe shall not be less than 99.9%. (3) the welding field wind-proof, rain-proof measures must be taken, when the relative humidity is greater than 90%, when the wind speed is greater than 2m/s, do not allow application of argon arc welding, when the wind speed is greater than 8M/s, do not allow the application of arc welding. Welding shall not be less than 0 ? ambient temperature. (4) prior to welding, you should review the lip size, meet the requirements before they