Ashley Pape

Ashley Pape

  • NA
  • 4
  • 522

Why won't my "Delete an entry" section of code work?

Apr 9 2020 11:26 AM
I have tried this:
 
if (menuChoice == 4)
{
Console.WriteLine("Delete a Movie");
for (i = delete - 1; i < showTitles.Length; i++)
{
showTitles[i] = showTitles[i + 1];
}
Console.WriteLine("New List:");
for (i = 0; i < showTitles.Length; i++)
{ Console.WriteLine("Movies[" + (i + 1) + "]: " + showTitles[i]); showTitles[i] = Console.ReadLine();
} Console.WriteLine();
} 
 
and: 
 
else if (menuChoice == 4)
{
newShowTitles = new string[showTitles.Length - 1];
Console.WriteLine("Delete a Movie");
if (a < showTitles.Length)
{
if (a != (delete - 1))
{
newShowTitles[b] = showTitles[a];
b++;
}
a++;
}
for (int c = 0; c < newShowTitles.Length; c++)
{
showTitles[c] = newShowTitles[c];
}
num--;
}
 
 
Neither of these codes are able to do anything... When I get to this section all that comes up on the console is "Delete a Movie" and it goes back to the main menu.... Please help!! 

Answers (1)