Gerçekten en zorlandıklarımdan biri oldu. Hatta hepsini yapamadım ve buraya konu açtım. Sağ olsunlar yardımcı oldular. Yani yarısı benim yarısı buranın Sayısal Loto değerini "dogrulama" değişkenini değiştirerek kendiniz değiştirebilirsiniz.
Test etmek için Online Compiler;
Test etmek için Online Compiler;
Online C Compiler
The user friendly C online compiler that allows you to Write C code and run it online. The C text editor also supports taking input from the user and standard libraries. It uses the GCC C compiler to compile code.
www.programiz.com
C:
#include <stdlib.h>
#include <stdio.h>
int main()
{
int rastgeleSayi;
srand(time(NULL));
int dogrulama[6] = {11, 38, 23, 14, 33, 12};
int loto[49] = {0};
int sayac = 0;
printf("Sayiler uretiliyor...\n");
for (int i = 0; i < 6; i++)
{
rastgeleSayi = 1 + rand() % 49;
while (loto[rastgeleSayi - 1] == 1)
{
rastgeleSayi = 1 + rand() % 49;
}
loto[rastgeleSayi - 1] = 1;
printf("%d ", rastgeleSayi);
for (int j = 0; j < 6; j++)
{
if (dogrulama[j] == rastgeleSayi)
sayac++;
}
}
printf("\n%d Bildiniz\n", sayac);
if (sayac == 6)
{
printf("\nKazandiniz! Ama haram be kardesim :)\n");
}
printf("\nSayisal Loto tamamlandi.\n");
system("pause");
return 0;
}