汇编输入字符串并MessageBox提示长度是否大于8

.386
.model flat,stdcall
option casemap:none

include msvcrt.inc
includelib msvcrt.lib
include kernel32.inc
includelib kernel32.lib
include user32.inc
includelib user32.lib
.data
szNote db "please input a string to judge if strlen longer than 8:",0Ah,00h
szPause db "pause",00h
szFormat db "%s",00h
szBuff db 100 dup(0)
szYes db "Yes",0
szNo db "No",0
.code
main:
	push offset szNote
	call crt_printf
	add esp,4
	
	
	push offset szBuff
	push offset szFormat
	call crt_scanf
	add esp,4
	
	
	call crt_strlen
	add esp,4
	cmp eax,8
	
	
	jg greater;if strlen>8 jmp greater
	;else MB"no"
	push 0
	push 0
	push offset szNo
	push 0
	call MessageBox
	
	push offset szPause
	call crt_system
	add esp,4
	ret
greater:
	push 0
	push 0
	push offset szYes
	push 0
	call MessageBox
	ret
	
	
end main
end

 

你可能感兴趣的:(assembly)