in this luck game I have to write numbers at the app with console readline. So basicaly game works like this:
you can select 5 numbers from 1-34 and seperatly 1 number from 1-14. if you guess every number it will show like this 5+1, 5, 4+1, 4, 3+1,3 etc.
here is the code
int[] sayilar = new int[5] { 0, 0, 0, 0, 0 };
int sayi;
bool durum = false;
Random r = new Random();
int i = 0;
while (i < 5)
{
sayi = r.Next(1, 35);
int j = 0;
do
{
if (sayi == sayilar[j]) { durum = true; break; }
j++;
}
while (j < 5);
if (durum == true)
{
durum = false; continue;
}
else
{
sayilar[i] = sayi; i++;
}
}
Array.Sort(sayilar);
foreach (int a in sayilar)
Console.Write("{0} ", a);
Console.WriteLine("+ {0}", r.Next(1, 15));
Console.ReadKey();
so what I want is write the numbers in application and when the winning numbers came it should show me which one is correct and correct rate like 5+1. Thank you
Aucun commentaire:
Enregistrer un commentaire