Мой вопрос в том, как я могу переписать этот код так, чтобы массив очистился, если пользователь выводит больше баллов для боулинга?Устранение значений массива для новых записей
while (!userIsDone)// loop will continue as long as the userIsDone = false
{
Console.Write("\nWould you like to process another set of bowling scores?");// prompt user to input Y or N to quit or to
Console.WriteLine("\nPress 'Y' to process another set or 'N' to exit the program");// input new bowling scores
string userInput = Console.ReadLine();// reads the user input to check against if/else below
if (userInput == "N")// if userInput is literal N the program will exectute this block
{
userIsDone = true;//exits program by setting userIsDone to true
}
else if (userInput == "Y")//if the user inputs a literal Y this block will execute
{
Console.Clear();// clears the console
break;// jumps out of the loop and returns to the prompt to input scores
}
else
{
// left blank to end the if and return to beginning of while because userInput was not Y or N
}
}//end while
//end do while
} while (!userIsDone);// continues to loop until userIsDone is true
}
}
}
Edit: Извините за не прикладывая то, что я сделал до сих пор, я уже возиться с Array.Clear, но я хочу знать, если есть другой способ, чтобы очистить его без используя встроенные методы.
[Что вы пробовали до сих пор?] (Http://whathaveyoutried.com) Возможно, взгляните на [«Как спросить хорошие вопросы»] (http://stackoverflow.com/help/how-to -ask) и покажите, что вы уже приложили немало усилий для решения своей проблемы. – AbcAeffchen