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.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here