Starting from:
$24.99

$18.99

Lab Task #5 Solution

This lab task will provide you with the experience of working with pointers and pointer arithmetic.

 
 

TASKS

 

Write a program that calls the following functions:

 

§  A function that accepts as arguments an array of integers and an integer that indicates the number of the elements in the array. The function should determine and return the mode of the array. The mode of a set of values is the value that occurs most often or with the greatest frequency. If the array has no mode (none of the values occur more than once), the function should return -1. You may assume that the array will always contain nonnegative values.

 

§  A function that accepts as arguments an int array and an integer that indicates the number of the elements in the array. The function should determine and return the median of the array. When a set of values is sorted in ascending or descending order, its median is the middle value. If the set contains an even number of values, the median is the mean, or average, of the two middle values. The value should be return as a double. You are required to use a temporary array for the sorting. The original array should not be changed.

 

§  A function that accepts an int array and the array’s size as arguments. The function should reverse the content of the array.

 

For this task, you are required only to use the pointer notation instead of array notation.

More products