SPIM lab
Tom Kelliher, CS26
Sept. 19, 1996
We'll meet initially in Hoyt 369, then repair to the Math/CS Lab.
Work on the following programs, in any order you like:
- Write a program which reads (from the keyboard) a person's name (a
string) and age (an integer). The program should greet the person, using
their name and then print ``You're old!!'' if the person is 20 or older and
print ``Shouldn't you be at home?'' otherwise.
- Write a simple calculator program which accepts inputs and sums them.
If an input of 0 is read, print the sum and exit.
- Write a program that reads a line of characters (no more than 128
characters on a line) and then determines and prints the number of
characters and words on the line.
- Experiment with the sorting routine we worked on in class. You can
prompt the user for integer values to store in the array, or pre-store
values in the array using declarations like this:
.data
array: .word 5, 4, 3, 2, 1
n: .word 5
After sorting, add a for loop to print out the values in the array,
verifying that they're now in sorted order.
Don't forget: the easiest way to write an assembly language program is to
first write a C program.
Thomas P. Kelliher
Wed Sep 18 09:45:43 EDT 1996
Tom Kelliher