Question: TASK 1 : Use the template code provided for you. Replace ? ? for Created by: , Creation Date: , and Synopsis ALL function prototypes
TASK : Use the template code provided for you. Replace for Created by:Creation Date: and Synopsis
ALL function prototypes have been provided for you. DO NOT add any more function prototypes.
You will fill in code in the main function according to the algorithm specified in the comments.
You will place function definitions AFTER the main function.
Comment your functions see last sentence above in the first paragraph above
Each function parameter should have a comment explaining the parameter.
You will define five functions as described below These functions are called from the function main. Please write your program incrementally.
TASK : In the function main, there are three comments that start with INSERT CODE HERE Write code to satisfy the directions given in the comments below the comment INSERT CODE HERE You will declare a pointer variable called list, allocate an array into this variable using dynamic memory allocation ie use the new operator and finally deallocate the array.
TASK : Define the function readsize to prompt and input the size of the array from the user. If the entered size is not positive, then repeatedly reprompt the user.
TASK : Define the function readlist that will prompt and input from the user each element to be stored in the dynamically allocated array. Use pointer arithmetic see the lecture notes on Pointers to access the array elements in your solution.
You will use the dereference operator, ie and use the first input parameter as a pointer variable.
Note DO NOT use square bracket notation to access elements in the array. Using square bracket notation in your solution will receive no credit.
TASK : Define the function displaylist that will display the array elements to the screen as a comma separated list. Use pointer arithmetic to access the array elements in your solution.
You will use the dereference operator, ie and use the first input parameter as a pointer variable.
Note DO NOT use square bracket notation to access elements in the array. Using square bracket notation in your solution will receive no credit.
TASK : Define the function findmin that will search for the smallest minimum element in the array. Use pointer arithmetic to access the array elements in your solution.
You will use the dereference operator, ie and use the first input parameter as a pointer variable.
Note DO NOT use square bracket notation to access elements in the array. Using square bracket notation in your solution will receive no credit.
HINT: To help you write your solution for function findmin, please study the following algorithm below that finds the maximum value in the array of integers variable array where variable n is the size of the array. This example is found in your lecture notes. The variable arraymax will hold the maximum value in the array. Though this code uses square bracket notation, remember that you CANNOT use square bracket notation in your implementation of the function findmin.
arraymax array; max A; for int i ; i n; i for i to n do if arrayi arraymax if Aimax then arraymax arrayi; max A; endif endfor The variable arraymax will contain the maximum value in the array
Thoroughly test your program on different input. For example, test your program when the user does not enter any valid value or just a single valid value. These are called corner or boundary cases. Use the provided test cases as well.
Be sure that there is a comment documenting each variable.
Be sure that your if statements, for and while loops and blocks are properly indented.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
