Unatkoztam...

...úgyhogy összedobtam egy egyszerű játékprogramot. Íme:

#include <stdio.h>
void main(void)
{
    char golyoh;
    FILE *random;
    char folosleges[0];
    printf("\x1B[1;31mOROSZ RULETT\x1B[0;39m\n");
    random=fopen("/dev/urandom", "r");
    while(!((golyoh<=6)&&(golyoh>0)))
    {
        fread(&golyoh, 1, 1, random);
    }
    printf("Golyo betoltve...\nLoves: [ENTER]\nKilepes: ^C\n");
    for(;golyoh;golyoh--)
    {
        gets(folosleges);
        printf("CLICK\n");
    }
    printf("BANG!\n");
}

Hozzászólások

biztos jo, bar dev-c++ int main(void) -dal birta compile-olni, aztan az alkalmazas vmi memoria "irasi" hibaval megdoglott. lehetoleg csak papiron es/vagy gepen teszteld te is ;]

De neked is csak veletlenul muxik..
gcc nem veletlenul dob warningot:

warning: the `gets' function is dangerous and should not be used.

Attol, hogy foloslegest 0 hosszukent deklaraltad, gets meg irja szepen az altala mutatott memoriateruletre az stdin- rol olvasott cuccokat, pont annyit, amennyit olvasott. Nekem pl ez pont felulirta a golyoh valtozohoz rendelt memoriateruletet, es soha nem ert veget a progid..

Javasolt modositas:
char folosleges[0]; -> char folosleges[200];
gets(folosleges); -> fgets(folosleges, 200, stdin);

Akkor itt a hibajavított változat:

#include <stdio.h>
void main(void)
{
    char golyoh;
    FILE *random;
    printf("\x1B[1;31mOROSZ RULETT\x1B[0;39m\n");
    random=fopen("/dev/urandom", "r");
    while(!((golyoh<=6)&&(golyoh>0)))
    {
        fread(&golyoh, 1, 1, random);
    }
    printf("Golyo betoltve...\nLoves: [ENTER]\nKilepes: ^C\n");
    for(;golyoh;golyoh--)
    {
        getchar();
        printf("CLICK\n");
    }
    printf("\x1B[1;31mBANG!\x1B[0;39m\n");
}