[Solved] CPSC 121-Lab 5

File Name: CPSC_121-Lab_5.zip
File Size: 131.88 KB

SKU: [Solved] CPSC 121-Lab 5 Category: Tag:

Or Upload Your Assignment Here:


Create a program that:

  1. Prompts the user to input values for an array of five integers
    1. HINT: It helps your programming flow a LOT if you call the same function used in part 2.g
  2. Displays a menu, where the user may choose
    1. Sum – Calculates and displays the sum of numbers in the array
      1. Use this definition (with reference variable as parameter):
      2. void Sum(int array[], int & result)//stores sum in result
    2. Mean – Calculates and displays the average of numbers in the array. Should not round.
      1. Should not be an integer! ii. Should use the “Sum” function defined above
    3. Display – Displays the current values held in the array
      1. Alternatively, you can just display it at the start of the menu’s prompt
    4. Sequencing – Displays the difference between each adjacent set of values
      1. Ie if we had {3, 5, 2, 9, 0}, we would get the output 2 -3 7 -9
      2. This just needs to be printed, not saved
    5. Search – Indicate whether the user’s chosen value is contained in the array, or not (boolean result should be returned, ie bool function).
    6. Sort – Arrange the values within the array so that they are in ascending order.
      1. Bubble or Selection sort will be relevant
      2. Extra Credit for BOGO sort (google/wiki)
    7. Edit – The user is re-prompted for input into the array (all elements)
    8. Exit – terminate the program
  3. Loop back to step 2

There should be at least 4 functions used in this program, including the function definition provided to you. The argument should be the array itself in most of these functions.

You should probably use a global const int for array size. Do not use global variables unless they’re constants!

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart