Question
/*function which takes the array as input and prints the duplicate values in that array using pointers.*/ void FindDuplicates(int p[],int N){ cout < < List
/*function which takes the array as input and prints the duplicate values in that array using pointers.*/ void FindDuplicates(int p[],int N){ cout<< "List of Duplicate values "; int count=0; int x, y;
for (x = 0; x < N; ++x) { for (y = x+1; y < N; ++y) { if (*(p + x) > *(p + y)) { int temp_save=*(p+x); *(p + x) =*(p + y); *(p + y)=temp_save; } } }
int i; for(i=0 ; i < N ;i++){ if(*(p +i) == *(p +i +1)) { if (*(p +i) == *(p +i -1)) { continue; }else{ cout<< " " << *(p +i) < if(count==0){ cout<<"There are no duplicate values to be shown"< The above function takes an array as an input and prints the duplicates in the array. It can only identify whether it is a duplicate or not. As an example if I enter 23,45,23,45,23 it will identify the duplicates as 23 and 45. I want to edit this function in order to print the times that the duplicate value appears as well. As an example the function should print The duplicates are 23 and 45 . 23 is entered 3 times . 45 is entered 2 times. Please edit this code to do so.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started