检查用户输入的字符串是否为字母数字

时间:2019-03-19 06:54:07

标签: mips

我需要MIPS方面的帮助以及正在开发的代码。我想让代码检查用户输入的字符串是否为字母数字,并且由于我不熟悉MIPS,因此需要一些帮助。

https://rosettacode.org/wiki/Determine_if_a_string_is_numeric#MIPS_Assembly

我已经关注了上面的网站,但是我真的不知道如何制作它,以便我可以同时检查两个字母数字。我的想法是检查每个字符,然后放置某种标记以通知它是否不是字母数字,但我不知道该如何写。

如果您希望参考的话,下面是我目前拥有的代码。

    askpass: .asciiz "Welcome to digital lock! Input your number.\n1) Store new password\n2) Unlock\n "
    wrongpass: .asciiz "Wrong password! Try again"
    password: .space 30
    notstrong: .asciiz "Password not strong enough! Password need to contain at least 8 characters must be alphanumeric."
    storingPass: .asciiz "Store your password! Your password must be alphanumeric and contain at least 8 characters\n"
.text

    li $v0, 4       #printing intro
    la $a0, askpass
    syscall

    li $v0, 5       #get int
    syscall
    move $t0, $v0       #storing int

    addi $t1, $zero, 1

    beq $t0, $t1, storePass


    li $v0, 10      #ending program
    syscall

storePass:          #storing password function
    li $v0, 4
    la $a0, storingPass
    syscall

    li $v0, 8       #get password
    la $a1, password
    li $a1, 30
    syscall


    li $v0, 10
    syscall

0 个答案:

没有答案