Újrajátszás
This commit is contained in:
@@ -21,47 +21,69 @@
|
|||||||
//Tippek bekérése
|
//Tippek bekérése
|
||||||
//1 és hanySzam között kell lennie
|
//1 és hanySzam között kell lennie
|
||||||
//Nem lehet a tippek között
|
//Nem lehet a tippek között
|
||||||
|
char valasz = 'n';
|
||||||
|
|
||||||
for (int i = 0; i < hanySzam; i++)
|
|
||||||
{
|
|
||||||
Console.Write($"{i + 1}.tipp:");
|
|
||||||
int temp = Convert.ToInt32(Console.ReadLine());
|
|
||||||
//Ellenőrzés
|
|
||||||
while (temp < 1 || temp > mennyiBol || tippek.Contains(temp))
|
|
||||||
{
|
|
||||||
Console.Write($"Rossz tipp! Újra! {i + 1}.tipp:");
|
|
||||||
temp = Convert.ToInt32(Console.ReadLine());
|
|
||||||
}
|
|
||||||
tippek[i] = temp;
|
|
||||||
}
|
|
||||||
Array.Sort(tippek);
|
|
||||||
Tomblista(tippek);
|
|
||||||
|
|
||||||
//Nyerőszámok sorsolása
|
//ciklus kezdete
|
||||||
for (int i = 0; i < hanySzam; i++)
|
do
|
||||||
{
|
{
|
||||||
int temp = random.Next(1,mennyiBol+1);
|
talalatok = 0;
|
||||||
while (nyeroszamok.Contains(temp))
|
|
||||||
|
|
||||||
|
|
||||||
|
for (int i = 0; i < hanySzam; i++)
|
||||||
{
|
{
|
||||||
temp = random.Next(1, mennyiBol + 1);
|
Console.Write($"{i + 1}.tipp:");
|
||||||
|
int temp = Convert.ToInt32(Console.ReadLine());
|
||||||
|
//Ellenőrzés
|
||||||
|
while (temp < 1 || temp > mennyiBol || tippek.Contains(temp))
|
||||||
|
{
|
||||||
|
Console.Write($"Rossz tipp! Újra! {i + 1}.tipp:");
|
||||||
|
temp = Convert.ToInt32(Console.ReadLine());
|
||||||
|
}
|
||||||
|
tippek[i] = temp;
|
||||||
}
|
}
|
||||||
nyeroszamok[i] = temp;
|
Array.Sort(tippek);
|
||||||
}
|
Tomblista(tippek);
|
||||||
Array.Sort(nyeroszamok);
|
|
||||||
Tomblista(nyeroszamok);
|
//Nyerőszámok sorsolása
|
||||||
//Találatok meghatározása
|
for (int i = 0; i < hanySzam; i++)
|
||||||
for (int i = 0; i < tippek.Length; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < nyeroszamok.Length; j++)
|
|
||||||
{
|
{
|
||||||
if (tippek[i] == nyeroszamok[j])
|
int temp = random.Next(1,mennyiBol+1);
|
||||||
|
while (nyeroszamok.Contains(temp))
|
||||||
{
|
{
|
||||||
talalatok++;
|
temp = random.Next(1, mennyiBol + 1);
|
||||||
|
}
|
||||||
|
nyeroszamok[i] = temp;
|
||||||
|
}
|
||||||
|
Array.Sort(nyeroszamok);
|
||||||
|
Tomblista(nyeroszamok);
|
||||||
|
//Találatok meghatározása
|
||||||
|
for (int i = 0; i < tippek.Length; i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < nyeroszamok.Length; j++)
|
||||||
|
{
|
||||||
|
if (tippek[i] == nyeroszamok[j])
|
||||||
|
{
|
||||||
|
talalatok++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Console.WriteLine($"Találatok száma:{talalatok}");
|
Console.WriteLine($"Találatok száma:{talalatok}");
|
||||||
|
Console.Write("Akar újra játszani? (i/n)");
|
||||||
|
valasz = Console.ReadKey().KeyChar;
|
||||||
|
Console.WriteLine();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}//ciklus vége
|
||||||
|
while (Char.ToLower(valasz)!='n');
|
||||||
|
|
||||||
|
//Fusson a program addig, amíg a megadott tippekkel el nem érünk 4 találatot.
|
||||||
|
//Írja ki a program, hogy ez hány évbe telt.
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user