Array, java Array
Array:
For an array with a defined length, if the number is not filled with an array, all other null values are 0. If the subscript of the extracted array exceeds the range of the array, an uncertain number is output.
For an array with no defined length, all bits without digits are 0.
How to delete elements in a dynamic array
{
First find the element to be deleted, get the position of the element, and then overwrite it with the elements following it in sequence. The length of the array is reduced by one;
For example:
# Include <iostream>
Using namespace std;
Int main ()
{
Int a [5] = {1, 2, 3, 4, 5 };
Int count = 5, m;
While (count> 1)
{
Cin> m;
Cout <"delete" <m <"before:" <endl;
For (int I = 0; I <count; ++ I)
{
Cout <a [I] <"";
}
Cout <endl;
For (I = 0; I <count; ++ I)
{
If (a [I] = m)
{
For (int j = I; j <count-1; j ++)
{
A [j] = a [j + 1];
}
-- Count;
}
}
After cout <"delete" <m <":" <endl;
For (I = 0; I <count; ++ I)
{
Cout <a [I] <"";
}
Cout <endl;
}
Return 0;
}
}