-
November 30th, 2014, 03:10 PM
#1
arrays, functions and displays
I have a program that uses arrays and variables being sent to functions. But I am confused because when I use q or Q to break the loop of getting inputs it displays the previous input names and scores but also shows q or Q in the list. Is there a way to get it to not show my end loop variable?
code segment:
for (numPlayers = 0; numPlayers < Names.Length; numPlayers++)
{
Console.WriteLine("Please enter the name of the player. Enter q or Q at anything to end");
Console.WriteLine("the program and display scores if a player is disqualifed.");
Names[numPlayers] = Console.ReadLine();
Console.WriteLine("");
if (Names[numPlayers] == "q" || Names[numPlayers] == "Q")
{
break;
}
Console.WriteLine("Please enter the score for " + Names[numPlayers]);
Scores[numPlayers] = Convert.ToInt64(Console.ReadLine());
Console.WriteLine("");
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|