0
目前我得到的如何在MIPS中的同一行中打印字符串和另一個字符串變量?
dsajnd
輸出不是迴文
而且我希望它輸出使得(如dsajnd)和「不是迴文」上同一條線。
dsajnd不是迴文
我對印刷本的代碼是
true:
move $a3, $t0
la $v0, 4
syscall
# printing the true_msg, and exit.
la $a0, true_msg
li $v0, 4
syscall
b exit
false:
move $a3, $t0
la $v0, 4
syscall
la $a0, false_msg # printing the false_msg, and exit.
li $v0, 4
syscall
b exit
exit: ## exit the program:
li $v0, 10 # loading "exit" into $v0.
syscall
.globl Print_string
Print_string: # print the string whose starting address is in register a0
li $v0, 4
syscall
jr $ra
.data
buffer: .space 12
true_msg: .asciiz "is a palindrome"
false_msg: .asciiz "is not a palindrome"
推測輸入的字符串在結尾處包含換行符。去掉那個。 – Jester 2014-09-27 01:56:06