Professional Documents
Culture Documents
Program 12
Program 12
using System.Threading;
using System.Collections.Generic;
namespace sorteio
{
class Program
{
static void Main(string[] args)
{
int n, i, ns;
bool verdade, ver;
Random gerar = new Random();
}
for (i = 0; i < n; i++)
{
ns = gerar.Next(0, n);
ver = true;
while (ver)
{
verdade = lists.Contains(ns);
if (verdade)
{
ns = gerar.Next(0, n);
}
else
{
lists.Add(ns);
sorteado[i] = nome[ns];
ver = false;
}
}
}
Console.Write("\n\n");
for (i = 0; i < n; i++)
{
Console.WriteLine($"{i + 1}° sorteado: {sorteado[i]}");
Thread.Sleep(700);
}
}
}
}