Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For these two arrays of integers: array 1 : . word 9 1 , 1 5 , 7 6 7 , 8 6 1 ,
For these two arrays of integers:
array: word
array: word
There are some integer values that are in both of the arrays.
Write a program that uses two loops to count the integer values of array that are in array When an integer value of array is found to be in both arrays, place the count of the integer value in a $t register. When an integer is found to be in array but not in array place the count of the integer value as in a $t register. The $t registers should have the count of integer values placed in them in the following way:
the count of the first integer value of array should be placed in the register $t
the count of the second integer value of array should be placed in the register $t
the count of the third integer value of array should be placed in the register $t
the count of the forth integer value of array should be placed in the register $t
the count of the fifth integer value of array should be placed in the register $t
etc.
As an example, notice the value is in both arrays. Notice also that is the first integer value of array That means the count of is so should be placed in the register $t
As another example, notice the value is in array but not array Notice also that is the second integer value of array That means the count of is so should be placed in the register $t
As a third example. notice the value is in both arrays. Notice also that is the fifth integer value of array Also notice that occurs two times in array That means the count of is so should be placed in the register $t
The two loops should be arranged in a nested loop structure A nested loop is a loop inside another loop. The loop that is on the inside is called the inner loop. The loop that has the inner loop inside it is called the outer loop.
For this program, you are to use the outer loop to access all of the elements of arrayand use the inner loop to access all of the elements of array
Make sure in this program that the outer loop accesses all the elements that are in array and the inner loop accesses all the elements that are in array
As the loops run, if the inner loop accesses an element of array that is in array place the count of the array element into the corresponding $t register. If the inner loop does not access an element that is in array place the count of for the array into the corresponding $t register.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started