Program #1

Program #1 is worth 100 points, or 10% of your final grade.

This program flexes your muscles in the following areas:

Description

Write an assembly program that queries the user for an array of integers and manipulates them. Then, allow the user to select menu items to 1) report the minimum and maximum values in the array, 2) sort the numbers, or 3) quit the session.

Here's an example session (user input in bold):

How many numbers will you be entering? 5
Go.
Enter #1/5> 7
Enter #2/5> 17
Enter #3/5> 20
Enter #4/5> 3
Enter #5/5> 1
Done.
Entered: 7, 17, 20, 3, 1
Enter a choice [1=MinMax, 2=Sort, 3=Quit] > 1
Min is 1. Max is 20.
Enter a choice [1=MinMax, 2=Sort, 3=Quit] > 2
Sorted order is: 1, 3, 7, 17, 20
Enter a choice [1=MinMax, 2=Sort, 3=Quit] > 3
Done.

You should limit the size of the array at, say, 20 numbers. If the user requests more numbers than that (or less than 1), then print an error and exit.

Also, you must implement this program in two slightly different ways:

  1. Store the array of integers as an un-initialized global variable
  2. Store the array of integers as a local variable (presumably, local to main)

These should be separate executables.

Implementation

You can use any sorting algorithm you'd like. Bubble sort, insertion sort, and quicksort are all given in the CSC 160 textbook.

Please implement the following functions:

You can implement other functions as well, if you want to make your program easier to understand and follow.

You can implement your program in one large file or separate files.

I have no problem if you want to start with a "gcc -S" compiler-generated assembly code and work from there. The key is your "work from there." All compiler "quirks" must be removed. Your code must be completely commented to show/explain your understanding of its workings, be clean (and "mean") and only use constructs with which you are familiar.

Grading

This is an individual project. If you need help, please see me.

Please place your solution in a folder named "prog1" (or something similar) in your k: drive folder for our class. In this folder, you should include:

Always recompile and run your code here, on the k: drive, to exorcise any potential system-specific demons.

You will be graded on whether your solution works. You will also be graded on your ability to show you understand the code you turn in. You do this by

A program that works, without meeting these other criteria will lose (significant) points.

Hints, etc

Do this one section at a time. Get one function working, then move onto the next. For example:

  1. Read in numbers (scanf)
  2. Write numbers (printf)
  3. Report min/max
  4. Sort
  5. Add interactive menu on top of it all
  6. Do "the other" way of storing array (you should still be able to use all you old functions)

Oct 27, 2003

Some more stuff for you in your quest: