Question: Assume a is an arbitrary array of integer values. As an example, considerwhere MAXARRAY is the maximum number of data items that can be stored

Assume a is an arbitrary array of integer values. As an example, considerwhere MAXARRAY is the maximum number of data items that can be stored in the array, and asize is the current number of items held in a.
Requirement 1.
You are asked to write the function
void deleteDuplicates(int a[], int& asize)
to modify the array content so that each of its initial values will appear only once in the new version of the array. For instance, the sample array above will become {22,11,33,44,55}. Observe its size (asize) changes from 8 to 5 elements (the duplicate values 22 and 11 are written only once). Please, note that the parameter asize is supplied by reference.
Requirement 2.
Write a function to tell how many times a given value appears inside an array. The method's header follows
int countOccurrences(int a[], int asize, int item); where a is the array and asize its size. The parameter item is the value to be counted. For example, assume the array a given above. The call countOccurrences(a, assize, 11) returns 3(number of times that 11 occurs in the array a).
Requirement 3.
Your function deleteDuplicates MUST be designed so it relies on the countOccurrences method to create the solution.
Requirement 4.
Write a function void printArray(string caption, int a[], int asize); to print a caption and then the array's contents (see sample below).
ADITTIONAL PROBLEM-SPECS.
Do not use sorting-the-arrays as a solution strategy.
You must use prototypes. The first function in your source code must be main(). All the user-defined functions must be listed after the main() method. Failure to organize the app this way will result in a 10 points deduction.
Your app must work for any given integer array.
Do not display anything inside the deleteDuplicates() function.
Submit your answer using the same formatting style applied to Lab reports (code, snapshot).
Sample output your
app must produce.
Initial array [22,11,33,11,44,11,55,22,]
Modified array [22,11,33,44,55,]
Assume a is an arbitrary array of integer values.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!