[Solved] Slot Machine in C (gotoxy)


You have infinite loops in all functions. If you enter one function you never return.

Consider putting this while in main function.

#include <stdio.h>
#include <time.h>
...

int main(){

        srand( time(0) );
        fnSlotMachine();
        while(1) {
          fnSlot1();
          fnSlot2();
          fnSlot3(); 
        }
}

...    
void fnSlot1(){

            Sleep(50);
            fnGotoXY(5, 9);
            intSlot1 = rand() % 9;
            printf(" | %i %i %i |\n", intSlot1, intSlot1, intSlot1);
            fnGotoXY(2, 10);
            printf("    | %i %i %i |\n", intSlot1, intSlot1, intSlot1);
            fnGotoXY(2, 11);
            printf("    | %i %i %i |",   intSlot1, intSlot1, intSlot1);

}

void fnSlot2(){


            Sleep(50);
            fnGotoXY(17, 9);
            intSlot2 = rand() % 9;
            printf("| %i %i %i |\n", intSlot2, intSlot2, intSlot2);
            fnGotoXY(17, 10);
            printf("| %i %i %i |\n", intSlot2, intSlot2, intSlot2);
            fnGotoXY(17, 11);
            printf("| %i %i %i |",   intSlot2, intSlot2, intSlot2);

}

void fnSlot3(){


            Sleep(50);
            fnGotoXY(27, 9);
            intSlot3 = rand() % 9;
            printf("| %i %i %i |\n", intSlot3, intSlot3, intSlot3);
            fnGotoXY(27, 10);
            printf("| %i %i %i |\n", intSlot3, intSlot3, intSlot3);
            fnGotoXY(27, 11);
            printf("| %i %i %i |",   intSlot3, intSlot3, intSlot3);

}

solved Slot Machine in C (gotoxy)