a. Explain what is happening in the program b. Come up with a mechanism which shows that this program is indeed in an infinite loop. c. Come up with a solution which fixes this problem.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 7PE
icon
Related questions
icon
Concept explainers
Question

# subprogram: PrintInt
# author: Charles W. Kann
# purpose: To print a string to the console
# input: $a0 - The address of the string to print.
# $a1 - The value of the int to print
# returns: None
# side effects: The String is printed followed by the integer
value.
.text
PrintInt:
 # Print string. The string address is already in $a0
 li $v0, 4
 syscall

 # Print integer. The integer value is in $a1, and must
 # be first moved to $a0.
 move $a0, $a1
 li $v0, 1
 syscall
 # Print a new line character
 jal PrintNewLine
 #return
 jr $ra
When the program is run, it never ends and acts like it is stuck in an infinite loop. Help
this colleague figure out what is wrong with the program.
a. Explain what is happening in the program
b. Come up with a mechanism which shows that this program is indeed in an infinite
loop.
c. Come up with a solution which fixes this problem. 

need accurate ans otherwise you will get downvote

# subprogram: PrintInt
# author: Charles W. Kann
# purpose: To print a string to the console
# input: $a0 - The address of the string to print.
# $a1 - The value of the int to print
# returns: None
# side effects: The String is printed followed by the integer
value.
.text
PrintInt:
 # Print string. The string address is already in $a0
 li $v0, 4
 syscall

 # Print integer. The integer value is in $a1, and must
 # be first moved to $a0.
 move $a0, $a1
 li $v0, 1
 syscall
 # Print a new line character
 jal PrintNewLine
 #return
 jr $ra
When the program is run, it never ends and acts like it is stuck in an infinite loop. Help
this colleague figure out what is wrong with the program.
a. Explain what is happening in the program
b. Come up with a mechanism which shows that this program is indeed in an infinite
loop.
c. Come up with a solution which fixes this problem. 

need accurate ans otherwise you will get downvote

Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Operators
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage