using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Lab5_A
{
class Program
{
static void InputData(ref int counter, string[] playerName, int[] playerScore)
{
string aValue = null;
Console.Write("Enter Player Name (Q to quit): ");
playerName[counter] =Console.ReadLine();
Console.Write("\nEnter score for {0}:", playerName[counter]);
aValue = Console.ReadLine();
playerScore[counter] = int.Parse(aValue);
return;
}
static void Main(string[] args)
{
string[] playerName = new string[100];
int[] playerScore = new int[100];
string endProgram = "Q";
int counter = 0;
playerName[counter] = "temp";
// while player name does not equal 'Q'
{
do
{
playerName[counter] = null;
playerScore[counter] = 0;
InputData(ref counter, playerName, playerScore);
counter++;
}
while (playerName[count] != endProgram)
}
}
}
}
Not sure the best way to check for the value 'Q' in a string.
I tried a few different lines of code, but I'm not sure of the "proper" C# way to do this... Obviously I'm talking about the while (playerName[count] != endProgram)
line.
Any coders want to help out a newbie? I checked both my textbook and internet sources, and I can't find the right way to do this.
Thanks.
Jim