Write a MIPS assembly language program that implements the following pseudo-code operation:
result = x + y – z + A[j]
x and y should be in reserved memory words using the .word directive and labeled as x and y. Initialize x=10 and y=200.
Read in z from the console. Input the value -8. This is the value for z, not for –z. Store this value in memory with the label z. To begin, you could just initialize z to a value using .word directive and test your code.
Read in j from the console. The value of j should be in the range [0, 3]. Input the value 2. You do not need to check j for the proper range on input.
Reserve 4 words in memory for A with the label A. Assume A is referenced starting at A[0]. Initialize these 4 words to: 4, 9, 15, 20. E.g.,:
A: .word 4, 9, 15, 20
Which number is A[j]? In order to get an element, you will need the load address instruction, which loads the address of a label into a register. E.g., to load the starting address of label A, A[0], into $t0, you would do the following:
la $t0, A
You can then use $t0 as an address in the normal way for an lw or sw instruction, as needed.
Store the final result in a reserved memory word labeled result.
Your final data section might look like this:
.data
x: .word 10
y: .word 200
z: .word 0
A: .word 4, 9, 15, 20
result: .word 0
prf: .asciiz "The result is: " #String for printing
crlf: .asciiz "\n" #For printing a cr/lf
Output the result to the console prefixed by a string that reads (without the quotes):
"The result is: "
The result should follow this string on the same line. E.g., the output to the console might be:
The result is: 5768
Check your data segment to be sure values are stored appropriately. Only the memory locations for z and result should be changed from initial values.
In: Computer Science
In: Economics
In: Computer Science
how do I copy my word data to excel
I typed my report on word document and would like to
copy them on excel 2013 in other to add table and graph
In: Math
Chapter Name: Handmaid of ethics: Corporate Social Responsibility
Creative Question: (Some question have a requirements which is give with the question)
In: Economics
Exercise 3 – Strings
Using a function Write a program that prompts the user to enter two inputs: some text and a word. The program outputs the starting indices of all occurrences of the word in the text. If the word is not found, the program should output “not found”.
Example1:
Input1: my dog and myself are going to my friend
Input2: my
Output: 0 11 31
Example 2:
Input1: Programming is fun
Input 2: my
Output: not found
In: Computer Science
Recognizing partitions - sets of strings.
(b) Let A be the set of words in the Oxford English Dictionary (OED). For each positive integer j, define Aj to be the set of all words with j letters in the OED. For example, the word "discrete" is an element of A8 because the word "discrete" has 8 letters. The longest word in the OED is "pneumonoultramicroscopicsilicovolcanoconiosis" which has 45 letters. You can assume that for any integer i in the range 1 through 45, there is at least one word in the OED that has i letters. Do the sets A1, …, A45 form a partition of the set of words in the OED?
(don't give explanation with reflexive, symmetric and transitive because we haven't learn it yet)
In: Advanced Math
Grammar Check! "I never said she stole my money." Did you know that this sentence changes its meaning depending on which word you stress? Practice your grammar skills by stressing each word in the sentence; notice how the part of speech stressed affects the meaning of the sentence. Which word did you stress first? What meaning does that sentence have? Which word is the most awkward for you to stress? What meaning does THAT sentence have? For your peer responses this week, comment on at least two of your fellow learner's posts as to how you feel about their interpretation, and whether you feel similarly or differently.
In: Nursing
Write a recursive method that takes a String argument and recursively prints out each word in the String on a different line.
Note: You will need to use methods such as indexOf() and substring() within the String class to identify each word and the remaining string.
For example, if the input was “the cat purred”, then the method would print the following to the Java console:
the
cat
purred
Challenge Problem
Write a recursive method that takes a string as an input and returns a boolean value that tells you whether the string is a palindrome. A palindrome is a word/sentence that when read backwards is the same as the original word/sentence.
Some example palindromes: “civic”, “radar”, “deleveled”, “a man, a plan, a canal: Panama” (ignore the punctuation)
PreviousNext
In: Computer Science
In: Statistics and Probability