Assignment Description: Implement a MIPS assembly language program that defines
ID: 3884662 • Letter: A
Question
Assignment Description:
Implement a MIPS assembly language program that defines main, readArray and removeEvenOdd procedures.
The readArray takes an array of integers as its parameter, reads in integers from a user to fill the array and also print each value as long as it is with the number of elements specified by the parameter "howMany" and "length".
The removeEvenOdd procedure takes parameters of an array of integers, its length, and even value, an asks a user how many integers to read in and calls the readyArray procedure. Then it should go through the array to see if each number is even (divisible by 2) if the parameter even is 0. In that case, such even integer in the array is changed to 1. If the parameter even is 1, then it changes every odd integer in the array to 0. Then it prints out the updated content of the array.
The main procedure asks a user to specify whether to remove even or odd numbers by asking them to enter an integer. Then it calls the removeEvenOdd procedure. It repeats these two steps twice.
Please see the following C program to understand how it should work.
If your program causes an infinite loop, press Control and 'C' keys at the same time to stop it.
Name your source code file assignment6.s.
The following shows how it looks like in a C program:
The following is a sample output (user input is in bold):
Enter zero to remove even numbers or non-zero to remove odd numbers
0
Specify how many numbers should be stored in the array (at most 8):
8
Enter an integer:
1
Enter an integer:
-12
Enter an integer:
53
Enter an integer:
-4
Enter an integer:
5
Enter an integer:
32
Enter an integer:
1
Enter an integer:
7
The array content:
1
-12
53
-4
5
32
1
7
After removing even integers
1
1
53
1
5
1
1
7
Enter zero to remove even numbers or non-zero to remove odd numbers
1
Specify how many numbers should be stored in the array (at most 8):
5
Enter an integer:
1
Enter an integer:
-5
Enter an integer:
-2
Enter an integer:
3
Enter an integer:
2
The array content:
1
-5
-2
3
2
After removing odd integers
0
0
-2
0
2
Explanation / Answer
for read array-
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.