Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <iostream> using namespace std; int remove (intlist[], int size, int re

ID: 3613091 • Letter: #

Question

#include <iostream>

using namespace std;

int remove (intlist[], int size, int removeItem);

int main()

{

int list[20], i, removeItem,n;

cout<< "Enter size of list:"<<endl;

cin>>n;

cout<< "Enter the integers of the list:"<<endl;

for(i=0; i<n; i++)

{

cin>>list[i];

}

cout<< "Enter the integer you want toremove: "<<endl;

cin>> removeItem;

n=remove(list,n,removeItem);

cout<< "Integers after removal:"<<endl;

for(i=0; i<n; i++)

cout<< list[i];

system ("pause");

return 0;

}

int remove(intlist[], int size, int removeItem)

{

int loc, i;

bool found=false;

for(loc=0; loc<size;loc++)

{ found=false;

if(list[loc]==removeItem)

{

found=true;

}

if(found)

{

for(i=loc; i<size;i++)

list[i]=list[i+1];

size=size-1;

}

else

cout<<"Element does notexist."<<endl;

}

return size;

}

Explanation / Answer

please rate - thanks this should do it besides the changes in the function I added acout