Consider following method: bool replaceOne(int n1, int n2) { int i = 0; while(NumAry[i] != n1){ i = i+1; } if(i > counter){ return false; } if(NumAry[i] == n1){ NumAry[i] = n2; } } This method takes...


Consider following method:


bool replaceOne(int n1, int n2)
{
int i = 0;
while(NumAry[i] != n1){
i = i+1;
}
if(i > counter){
return false;
}
if(NumAry[i] == n1){
NumAry[i] = n2;
}
}


This method takes two numbers from user first one is to find and the other is to replace that number with. I want additional functionality in this method that if the number is found once in the array the method donot replaces it but search for same number for the rest of array two and if there occurs that number more than once then it will ask at which index you want to replace.



Jun 01, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here