彙編輸入字符串並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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章