253 assignment: CFUNCS

Come to class as there may be corrections, changes and additions.   Substantial accumulating late penalty.

  • Create a C / assembly project using Visual C++
  • Call the file folder CFUNCS
  • Zip and Hand in the FOLDER to D2L

In an empty Visual C++ project there will be FIVE files: main.c, Func1.asm, Func2.c, Func3.asm, Func4.c Use printf and scanf_s for I/O: int fav=99; printf("My favorite number is %d and in hex it is %x.", fav, fav); int val; printf("How many widgets? "); scanf_s("%d", &val); // provides the ADDRESS of the variable Create a main module in C (main.c) #include <stdio.h> Declare variables at the top of a function. Declare arrays as: int i[100]; Create an array of size 50 of random integers (0-99). srand( (unsigned int)time(NULL) ); // seed the random number generator, (#include <time.h>) r = rand()%100; // 0-99 Use 'dummy' array(s) with set values to make testing possible (easier!). int test1[8] = {5,1,1,1,5,8,5,5}; // sum(31), most repeated(5) // largest #(8), longest run (1 is number, 3 is length of run)
Create a MENU with these 5 options (use 1-5) and loop until exit 1. Func1 (will have two parameters: pointer to array and size of array) assembly sum of all items in the array return sum as value 2. Func2 (will have two parameters: pointer to array and size of array) c with inline assembly asm portion should be significant use a second array? *suggested - NOT required most repeated item in array (freque) return most frequent item as value 3. Func3 (will have two parameters: pointer to array and size of array) assembly largest item in the array return largest item as a value 4. Func4 (will have four parameters: pointer to array and size of array AND 2 reference params for return values) c with inline assembly asm portion should be significant longest "run" of numbers use a second array *suggested - NOT required provide info back to the caller as TWO reference vars (# and frequency) 5. Exit
All called functions will be in a separate file (.c or .asm) will have two parameters: pointer to array and size of array ** NOTE: Func4 will have 2 additional reference parameters will not require input or output - all I/O will be done in main