Untitled

mail@pastecode.io avatar
unknown
csharp
2 years ago
799 B
4
Indexable
Never
string[] typeS;
string[] typeD;
string[] typeM;
string[] typeO;

for (i = 0; i < numberOfContestanstThisYear; i++)
{
    do
    {
        Console.WriteLine("Enter the talent type of the participant >> (S,D,M,O must be uppercase)");
        typeOfTalent = Convert.ToChar(Console.ReadLine());
    } while ((typeOfTalent != 'S') && (typeOfTalent != 'D') && (typeOfTalent != 'M') && (typeOfTalent != 'O'));

    Console.WriteLine("Enter the name of the participant>>");
    nameOfParticipant = Console.ReadLine();
        
    if (typeOfTalent == 'S')
        typeS[] = nameOfParticipant;
    else if (typeOfTalent == 'D')
        typeD[] = nameOfParticipant;
    else if (typeOfTalent == 'M')
        typeM[] = nameOfParticipant;
    else if (typeOfTalent == 'O')
        typeO[] = nameOfParticipant;
}