1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
netineya [11]
2 years ago
10

Write a MIPS assembly language program that prompts for a user to enter how many floating point numbers to enter, then prompts t

o enter a series of floating point numbers and reads in numbers and store them in an array, then prints the original content of the array. Then it repeats it for a second array, and compare numbers from two arrays, and if a number in the first array is larger than the number of the second array of the same index, it swaps them. Then it should print the result contents for both arrays.
Computers and Technology
1 answer:
Natalija [7]2 years ago
5 0

Answer:

See explaination

Explanation:

.data

arraysize: .word 10

counter: .word 1

alreadystored: .word 0

num: .space 40 # reserve 40 bytes from the starting address of array

inputmsg: .asciiz "Enter a floating point number:\n"

outputmsg: .asciiz "The array contains the following numbers: \n"

.text

.globl main

main:

lw $t1, counter #counter

lw $t2, arraysize #max length of array

la $t0, num # base address of the array

#set initial flag for duplicate array element 0=entered value not present in array,1= entered value exists in array

li $t3,0 #reset the flag for alreadystored to 0

Loop 1:

# print input message prompt

la $a0, inputmsg

li $v0, 4

syscall

# get user entered keyboard input

li $v0, 6

syscall

# move user entered value from $f0 to array base address

s.s $f0, 0($t0)

#load the value at address pointed by $t0 to register $f1

l.s $f1,0($t0)

#compare the entered value in register $f0 to the value stored in $f1

c.eq.s $f1,$f0

#jump to loop2 if the values are not equal ie if the entered value is not duplicate then increment the array index and compare with next array element

bc1f loop2

#else make the value of flag alreadystored =1

li $t3,1

# if no duplicate then move to the next position in the array, increment loop counter

loop2:

addi $t0, $t0, 4

addi $t1, $t1, 1

ble $t1, $t2, Loop1

# reset loop counter, and array address for printing out the array elements

lw $t1,counter

la $t0, num

# print output message prompt

la $a0, outputmsg

li $v0, 4

syscall

print_array:

# print array elements

l.s $f12, 0($t0)

li $v0, 2

syscall

# print space

la $a0, 32

li $v0, 11

syscall

# increment loop counter and move to next array element

addi $t1, $t1, 1

addi $t0, $t0, 4

ble $t1, $t2, print_array

#Exit

li $v0,10

syscall

You might be interested in
Which of the following are examples of software? (Select all that apply)
olchik [2.2K]
Put a photo or something
8 0
2 years ago
Read 2 more answers
A feature that displays in the lower right corner of a selected range with which you can analyze your data by using Excel tools
bagirrra123 [75]

Answer:

Quick analysis tool.

Explanation:

Excel is a spreadsheet application package found in the Microsoft office suite. it's environment on the display screen is called a worksheet and a collection of the worksheets is called a workbook. The excel packet is used for data analysis and interpretation and presentation.

When a group of cells in a worksheet is selected, a small tool kit appears that the lower right corner, it is known as a quick analysis tool. It is use for easy and fast analysis and formatting of that selected group.

5 0
2 years ago
Read 2 more answers
A blue line, called a ____ line, that appears when you are dragging a GUI object on a Windows Form object indicates that the obj
ser-zykov [4K]

Answer:

snap

Explanation:

The line which appears when we are dragging an object of GUI on a object of  windows Form indicates that the object that is being dragged is aligned horizontally with the object which is connected by the blue line is called a snap line.

Hence we conclude that the answer to this question is snap line.

3 0
3 years ago
Expand and simplify the following expressions. 1/2 [ 2x + 2 ( x - 3)] *​
Lerok [7]

Answer: 2

x

−

3

Explanation:

4 0
2 years ago
im running out of gb on my phone, I have a lot of pics saved there and they're taking a lot of space, is there a way to back up
Varvara68 [4.7K]

Answer:

Google Drive

Explanation:

You should be able to download Google Drive, upload the pictures on there and delete them from your gallery. Then you can view them anytime you want.

3 0
3 years ago
Other questions:
  • You use worksheets to perform calculations. How do you perform these calculations?
    15·2 answers
  • True or false. Embedding only part of a font is called presetting.
    14·1 answer
  • What error occurs in the following program? #include using namespace std; int main() { int number1, number2, sum; cout <<
    13·1 answer
  • You respond to a fire at a pharmaceutical production plant. One of the outside storage tanks is on fire. The placard on the tank
    10·1 answer
  • Candy Kane Cosmetics (CKC) produces Leslie Perfume, which requires chemicals and labor. Two production processes are available:
    14·1 answer
  • A line graph is a great tool for showing changes over time. Why is a line graph better than other graphs at showing this type of
    6·1 answer
  • Please choose odd one out please tell fast​
    12·1 answer
  • What is a best practice when approaching an automation effort?
    6·1 answer
  • Three healthcare firms jointly own and share the same cloud resources to meet their computing needs. Which cloud model does this
    15·1 answer
  • These are pictorial images displayed on a computer screen​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!