Hi I'm creating a program that holds three arrays one for the persons last name, one for the points scored and one for the player number, now I've got all the arrays and everything done but I'm not sure as to how to return the 3 new arrays from my deletemethod so that I can pass it into my playerdelete method and I am also having troubles trying to replace the odd array value with a new one so that I can remove the player entry from the user entered list. Also I can't use objects.
any help or guidance would be appreciated
static Int32[] ProcessDelete(Int32[] playerNumbers, ref Int32 playerCount, String[] playerLastName, Int32[] playerPoints)
{
Int32[] newArray = new Int32[playerNumbers.Length]; String[] newArray2 = new String[playerLastName.Length]; Int32[] newArray3 = new Int32[playerPoints.Length];
int index = 0;
int index2 = 0;
int index3 = 0;
int r = 0;
int j = 0;
int t = 0;
while (index < playerNumbers.Length && index2 < playerLastName.Length && index3 < playerPoints.Length)
{
if (index != playerCount) { newArray[r] = playerNumbers[index]; }
{
}
if (0 != 1) { newArray[0] = playerNumbers[0]; }
{
}
if (0 != 1)
{
newArray[0] = 12; //the value of playerNumbers[0]}
}
index++;
if (index2 != playerCount) { newArray2[r] = playerLastName[index2]; }
{
}
if (0 != 1) { newArray2[0] = playerLastName[0]; }
{
}
if (0 != 1)
{
newArray2[0] = null;
}
index2++;
if (index3 != playerCount) { newArray3[r] = playerPoints[index3]; }
{
}
if (0 != 1) { newArray3[0] = playerPoints[0]; }
{
}
if (0 != 1)
{
newArray3[0] = 12;
}
index3++;
}
return newArray;
}
static void DeletePlayer(Int32[] playerNumbers, String[] playerLastName, Int32[] playerPoints, ref Int32 playerCount, Int32 MAXPLAYERS)
{
int player;// Player number to delete
int playerindex;//index of the player number in Array
if (playerCount < MAXPLAYERS)
{
player = GetPositiveInteger("\nDelete Player: please enter the player's number");
playerindex = GetPlayerIndex(player, playerNumbers, playerCount);
if (playerindex != -1)
{
{
Console.WriteLine("\nDelete Player: Number - {0}, Name - {1}, Points - {2}", playerNumbers[playerindex], playerLastName[playerindex], playerPoints[playerindex]);
Console.WriteLine("Succesfully Deleted");
Console.WriteLine();
ProcessDelete(playerNumbers, ref playerCount, playerLastName, playerPoints);
}
}
else
Console.WriteLine("\nDelete Player: player not found");
}
else
Console.WriteLine("\nDelete Player: the roster is empty");
}
}
}