Hi. Can anyone help me on my code? I wanted to delete a data inside a array, so what I did was to move the the array into another array without the one that is to be deleted. It is working if the user only wants to delete a single record. How can I improve my code without using vectors?
OR is there a better way of deleting data inside an array?
case 3:
{
System.out.println("Delete a array entry: ");
int d = Integer.parseInt(input.readLine());
while (i < a.length && j < b.length) {
if (d == a[i]) {
i++;
}
else {
b[j] = a[i];
i++;
j++;
}
}
break;
}
case 4:
{
System.out.println("View All");
for(i=1;i<a.length;i++)
{
if(a[i] == 0){
break;
}
else
System.out.println(a[i]);
}
break;
}