0

我的程序有错误。我并不是要求某人必须为我重写我的程序,但我们将不胜感激建设性的建议。

#print Guess
li $v0, 4
la $a0, Guess
syscall

#get user input
li $v0, 6
syscall

#store it to variable estimate
sw $v0, estimate

#calculate total 
lwc1 $f1, totalSquare
lwc1 $f2, totalCircle
add.s $f0, $f1, $f2
swc1 $f0, total

li $v0, 4
la $a0, totalMsg
syscall
li $v0, 2
mov.s $f12, $f0
syscall
li $v0, 4
la $a0, Newline
syscall 

#if  total > estimate, print MSG2. else, print MSG1 
lwc1 $f0, total
lwc1 $f1, estimate
c.lt.s $f0, $f1

bc1t MSG2

li $v0, 4
la $a0, MSG1
syscall

li $v0, 10
syscall 

displayMSG2:  
li $v0, 4
la $a0, MSG2
syscall

基本上,我想做的是看看 $f0 < $f1. 如果不是这样(或者换句话说,$f0 > $f1),则分支到“displayMSG2”否则,显示 MSG1

但是,当我运行代码时,无论我输入什么输入,它总是分支到 displayMSG2。我对 MIPS 很陌生,对高级语言最熟悉,所以我真的很想听听你的任何建议:)

4

0 回答 0