Control Structures Flashcards
The following MIPS assembly code:
beq $t0, $t1, label <a statement> label: <another statement> Implements which C++ control structure:
if ($t0 != $t1)
{
//a statement
}
// another statement
The following MIPS assembly code:
label: <a>
beq $t0, $t1, label
<another>
Implements which C++ control structure:</another></a>
do
{
//a statement
} while ($t0 == $t1)
// another statement
The following MIPS assembly code:
beq $t0, $t1, label1 <statement1> J label2 label1: <statement2> label2: Implements which C++ control structure:
if ($t0 != Tt1)
statement1
else
statement2
——————-
if ($t0 == Tt1)
statement2
else
statement1
The following MIPS assembly code:
label1: bne $t0, $t1, label
<a>
j label1
label2:
<another>
Implements which C++ control structure:</another></a>
while ($t0 == $t1) {
<a>
}</a>
<another>
</another>
The following MIPS assembly code:
bne $t1, $t2, label bne $t3, $t4, label2 label: <a statement> label2: <another statement> Implements which C++ control structure:
if ($t1 != $t2) || ($t3 == $t4) {
<a>
}</a>
<another>
</another>
The following MIPS assembly code:
bne $t1, $t2, label2 bne $t3, $t4, label2 label: <a statement> label2: <another statement> Implements which C++ control structure:
if ($t1 == $t2) && ($t3 == $t4) {
<a>
}</a>
<another>
</another>