Homework #6

#6 is Due Monday, June 1, 11:59 PM

The files should not be written to after the due date.
  • [7.5 points ]

    1. You are given two integer arrays a[MAX_SIZE] and b[MAX_SIZE], where MAX_SIZE is a constant that you can define to be equal to any value in your program. The array should be initialized by user input. You should promt user for two sets of ingeters with MAX_SIZE number of integers in both set. Array "a" should be initialized with the first set of integers, and array "b" should initiailzed with the second set of integers.

      Write a function to find the first array element, a[i] that is not equal to array element b[i]. The function should return -1 if this first unequal element a[i] < b[i], and +1 if a[i] > b[i]. If however the arrays a and b are identical, the function should return zero. The function should take the array names as parameters.

      Print out the result on screen.



    2. Use the above function to write a full program that can alphabetically sort 3 strings, read from user. Assume each input string is exactly of length at most MAX_SIZE -1 . printout 3 strings in sorted order. The smallest first and the bigget at last.
    Back to Grading & Homeworks Page