CS232, Spring 2008

Extra Credit Wombat5 - 3, 4, 5, 6, & 7 Assignments

Due: Friday, May 9 (last day of classes) at class time

General notes:

Exercise W5-3 Macros

Redo project W5-1 using macros instead of subroutines.

Details

Exercise W5-4 Searching arrays

Write a Wombat5 program "W5-4.a" that reads in a positive integer n followed by n more integers.  It stores the n integers in an "array" on the stack.  The main program then calls a subroutine "indexOfMax" to find the index of the largest integer in the array.  Finally the main program prints that largest integer. 

Details

Exercise W5-5 Sorting Arrays

Write a Wombat5 program "W5-5.a" that reads in an integer n followed by n more integers. Your program stores the n integers in an array of size n in the stack, as was done in Exercise W5-4.  It then sorts the n integers in place in the array using the indexOfMax function from Exercise W5-4 and a Selection Sort subroutine. After it is done sorting, your program writes out the n integers from smallest to largest. You may assume that n>=1. 

Details

Exercise W5-6 Recursively Sorting Arrays

Redo exercise W5-5 using a different sorting algorithm.

Details

Exercise W5-7 Adding boolean operators to the Wombat5

Add shifta, shiftl, and shiftc machine instructions and boolean bitwise and, xor, not and or machine instructions to the Wombat5, and then write a program to test some of them.

Details