In C language please Download bingo structc from the instruc
In C language please!!
Download \"bingo struct.c\" from the instructor’s website. This is a fully functioning program. Make sure that it compiles and run and test it for a while. This program uses C structs to store data. REWRITE this program so that it does not use structs. Instead, use a 2D array of 2D arrays, (A 4D array actually) with the following value encoding shown below. I suggest you develop the program by getting it to work with one bingo board first. You will have to change the way you are passing the boards around, see the prototypes below. There are several nested loops, the indexing ranges will change slightly, but the nesting order should not change. Mostly, you will be changing the way you reference data elements, and a little bit of logic.
// use this global table of Bingo boards instead of structs
 // Trow Tcol Brow Bcol
 unsigned char Table[TROWS][TCOLS][6][5];
 /*
 Value Encoding:
 1-50 numbers
 Page 7 of 7
 250 the ASCII dot, indicates that this number has been picked (not visible)
 66 B
 73 I
 78 N
 71 G
 79 O
 */
 // new prototypes for passing board array data
 void initBoard(char B[6][5]);
 void printBoard(char B[6][5]);
Struct Version of of the program(need to modify this to fit the description above)!!!!:
#include \"stdio.h\"
 #include \"stdlib.h\"
 #include \"string.h\"
 #include \"conio.h\"
 #include \"time.h\"
 #pragma warning (disable:4996)
// a single bingo board
 struct BingoBoard {
    char letters[5]; // the letters
    int nums[5][5]; // the numbers
    int visflag[5][5]; // is this number visible
 };
// a global 2D table of Bingo boards
 #define TROWS 3
 #define TCOLS 3
 struct BingoBoard Table[TROWS][TCOLS]; // REMOVE THIS DATA
/* a global table of Bingo boards, another way to do it
 ******USE THIS FOR YOUR HOMEWORK*****
This is a 4D array of BYTES.
 Can also be thought of as a 2D array OF 2D arrays.
Trow Tcol Brow Bcol
 unsigned char Table[TROWS][TCOLS] [6] [5]; // USE THIS DATA
Value Encoding:
 1-50 numbers
 250 the ASCII dot, indicates that this number has been picked (not visible)
 66 B
 73 I
 78 N
 71 G
 79 O
 */
 /*
 Initializes one bingo board
 */
 void initBoard(struct BingoBoard * B)
 // void initBoard(char B[6][5]) // the other way
 {
    int row;
    int col;
   B->letters[0] = \'B\';
    B->letters[1] = \'I\';
    B->letters[2] = \'N\';
    B->letters[3] = \'G\';
    B->letters[4] = \'O\';
   // fill with random numbers
    for (row = 0; row < 5; row++)
    {
        for (col = 0; col < 5; col++)
        {
            B->nums[row][col] = (rand() % 50) + 1; // 1 to 50
            B->visflag[row][col] = 1; // all visible
        }
    }
 }
 /*
 Prints one board on the console
 */
 void printBoard(struct BingoBoard B)
 // void printBoard(char B[6][5]) // the other way
 {
    int Brow;
    int Bcol;
   // first print letters
    for (Bcol = 0; Bcol < 5; Bcol++)
        printf(\" %c\", B.letters[Bcol]);
    printf(\"\ \");
   // print the numbers if they are visible,
    // otherwise print a dot (ASCII 250)
    for (Brow = 0; Brow < 5; Brow++)
    {
        for (Bcol = 0; Bcol < 5; Bcol++)
        {
            // print visible numbers only
            if (B.visflag[Brow][Bcol])
                printf(\"%3d\", B.nums[Brow][Bcol]);
            else
                printf(\" %c\", 250);
        }
        printf(\"\ \");
    }
 }
 /*
 Prints an NxN Table of Bingo boards to the console
 */
 void printTable()
 {
    int Brow;
    int Bcol;
    int Trow;
    int Tcol;
   // for each table row
    for (Trow = 0; Trow < TROWS; Trow++)
    {
        // first print letters for each board on this Trow
        for (Tcol = 0; Tcol < TCOLS; Tcol++)
        {
            // print letters for one board
            for (Bcol = 0; Bcol < 5; Bcol++)
                printf(\" %c\", Table[Trow][Tcol].letters[Bcol]);
            printf(\" \");
        }
        printf(\"\ \");
        // end print letters for this Trow
       // print numbers for each board on this Trow
        for (Brow = 0; Brow < 5; Brow++) // Brow
        {
            for (Tcol = 0; Tcol < TCOLS; Tcol++) // Tcol
            {
                for (Bcol = 0; Bcol < 5; Bcol++) // Bcol
                {
                    // print only the visible numbers
                    if (Table[Trow][Tcol].visflag[Brow][Bcol])
                        printf(\"%3d\", Table[Trow][Tcol].nums[Brow][Bcol]);
                    else
                        printf(\" %c\", 250);
                }
                printf(\" \");
            }
            printf(\"\ \");
        }
        printf(\"\ \");
        // end print numbers for this Trow
   } // next Trow
 }
/*
 Receives a bingo move and checks for these values on all the boards.
 Then checks for bingo
Returns the number of times this value appears on the boards,
 plus a bitflag to indicate bingo
 */
 int play(char ch, int num)
 {
    int Brow;
    int Bcol;
    int Trow;
    int Tcol;
    int found = 0;
    int bingo = 0;
    int i;
   // search every single number
    for (Trow = 0; Trow < TROWS; Trow++) // Trow
    {
        for (Tcol = 0; Tcol < TCOLS; Tcol++) // Tcol
        {
            for (Brow = 0; Brow < 5; Brow++) // Brow
            {
                for (Bcol = 0; Bcol < 5; Bcol++) // Bcol
                {
                    // look for a number match in this ch column
                    if (Table[Trow][Tcol].nums[Brow][Bcol] == num
                        && Table[Trow][Tcol].letters[Bcol] == ch)
                    {
                        Table[Trow][Tcol].visflag[Brow][Bcol] = 0;
                        found++;
                       // check for BINGO (an entire column filled)
                        if (!bingo) // neglect previous bingo from some other board
                        {
                            bingo = 64; // assume bingo! (a power of 2 bitflag)
                           // for each Brow
                            for (i = 0; i < 5; i++)
                                if (Table[Trow][Tcol].visflag[i][Bcol] != 0)
                                    bingo = 0; // alas, no bingo
                        }
                    }
                }
            }
        }
}
return found + bingo; // can take out the bingo later
}
/*
 Le main
 */
 void main(void)
 {
    time_t t;
    struct BingoBoard B1;
    int Trow;
    int Tcol;
    char ch;
    int num;
    int found;
   // seed generator
    srand((unsigned)time(&t));
   // initialize and print one board for testing
    //initBoard(&B1);
    //printBoard(B1);
   // initialize the global table of boards
    for (Trow = 0; Trow < TROWS; Trow++)
        for (Tcol = 0; Tcol < TCOLS; Tcol++)
            initBoard(&Table[Trow][Tcol]);
    // array version needs this ugly typecast:
    //initBoard((char (*)[5]) Table[Trow][Tcol]);   
printTable();
   // main game loop
    do
    {
        // prompt user for next move
        printf(\"DRAW! Example N5 (Q to quit): \");
       // get move from user
        ch = getche();
        if (ch == \'Q\')break; // terminate main loop
        scanf(\"%d\", &num);
       // play this user move
        found = play(ch, num);
printTable();
       // check for Bingo
        if (found >= 64)
        {
            printf(\"BINGO!!!! \");
            found -= 64; // take out the bitflag
        }
       // print results
        if (found)
            printf(\"%d occurance of %c%d found. \", found, ch, num);
        else
            printf(\"%c%d not found. \", ch, num);
} while (1);
printf(\"\ \");
}
Hints: T here is a line in plavo with Table[Trowl[Tcol].nums[Brow[Bcol] that will change to: Table[Trow[Tcol[Brow][Bcol] And another line in play0 with Table[Trow][Tcol].visflag[i[Bcol 0 Table[Trow][Tc01][i][Bcol1-250 that will change to: And a few other similar changes elsewhere Sample Output: RCWindows system32\\cmd.exe occurance of N20 found. DRAW? Example N5Solution
#include \"stdio.h\"
 #include \"stdlib.h\"
 #include \"string.h\"
 #include \"conio.h\"
 #include \"time.h\"
 #pragma warning (disable:4996)
 // a single bingo board
 //struct BingoBoard {
 char letters[5]; // the letters
 int nums[5][5]; // the numbers
 int visflag[5][5]; // is this number visible
 //};
 // a global 2D table of Bingo boards
 #define TROWS 3
 #define TCOLS 3
 //struct BingoBoard
 int Table[TROWS][TCOLS]; // REMOVE THIS DATA
 /* a global table of Bingo boards, another way to do it
 ******USE THIS FOR YOUR HOMEWORK*****
 This is a 4D array of BYTES.
 Can also be thought of as a 2D array OF 2D arrays.
 Trow Tcol Brow Bcol
 unsigned char Table[TROWS][TCOLS] [6] [5]; // USE THIS DATA
 Value Encoding:
 1-50 numbers
 250 the ASCII dot, indicates that this number has been picked (not visible)
 66 B
 73 I
 78 N
 71 G
 79 O
 */
/*
 Initializes one bingo board
 */
 //void initBoard(struct BingoBoard * B)
 void initBoard(char B[6][5]) // the other way
 {
 int row;
 int col;
 B->letters[0] = \'B\';
 B->letters[1] = \'I\';
 B->letters[2] = \'N\';
 B->letters[3] = \'G\';
 B->letters[4] = \'O\';
 // fill with random numbers
 for (row = 0; row < 5; row++)
 {
 for (col = 0; col < 5; col++)
 {
 B->nums[row][col] = (rand() % 50) + 1; // 1 to 50
 B->visflag[row][col] = 1; // all visible
 }
 }
 }
/*
 Prints one board on the console
 */
 //void printBoard(struct BingoBoard B)
 void printBoard(char B[6][5]) // the other way
 {
 int Brow;
 int Bcol;
 // first print letters
 for (Bcol = 0; Bcol < 5; Bcol++)
 printf(\" %c\", B.letters[Bcol]);
 printf(\"\ \");
 // print the numbers if they are visible,
 // otherwise print a dot (ASCII 250)
 for (Brow = 0; Brow < 5; Brow++)
 {
 for (Bcol = 0; Bcol < 5; Bcol++)
 {
 // print visible numbers only
 if (B.visflag[Brow][Bcol])
 printf(\"%3d\", B.nums[Brow][Bcol]);
 else
 printf(\" %c\", 250);
 }
 printf(\"\ \");
 }
 }
/*
 Prints an NxN Table of Bingo boards to the console
 */
 void printTable()
 {
 int Brow;
 int Bcol;
 int Trow;
 int Tcol;
 // for each table row
 for (Trow = 0; Trow < TROWS; Trow++)
 {
 // first print letters for each board on this Trow
 for (Tcol = 0; Tcol < TCOLS; Tcol++)
 {
 // print letters for one board
 for (Bcol = 0; Bcol < 5; Bcol++)
 printf(\" %c\", Table[Trow][Tcol].letters[Bcol]);
 printf(\" \");
 }
 printf(\"\ \");
 // end print letters for this Trow
 // print numbers for each board on this Trow
 for (Brow = 0; Brow < 5; Brow++) // Brow
 {
 for (Tcol = 0; Tcol < TCOLS; Tcol++) // Tcol
 {
 for (Bcol = 0; Bcol < 5; Bcol++) // Bcol
 {
 // print only the visible numbers
 if (Table[Trow][Tcol].visflag[Brow][Bcol])
 printf(\"%3d\", Table[Trow][Tcol].nums[Brow][Bcol]);
 else
 printf(\" %c\", 250);
 }
 printf(\" \");
 }
 printf(\"\ \");
 }
 printf(\"\ \");
 // end print numbers for this Trow
 } // next Trow
 }
 /*
 Receives a bingo move and checks for these values on all the boards.
 Then checks for bingo
 Returns the number of times this value appears on the boards,
 plus a bitflag to indicate bingo
 */
 int play(char ch, int num)
 {
 int Brow;
 int Bcol;
 int Trow;
 int Tcol;
 int found = 0;
 int bingo = 0;
 int i;
 // search every single number
 for (Trow = 0; Trow < TROWS; Trow++) // Trow
 {
 for (Tcol = 0; Tcol < TCOLS; Tcol++) // Tcol
 {
 for (Brow = 0; Brow < 5; Brow++) // Brow
 {
 for (Bcol = 0; Bcol < 5; Bcol++) // Bcol
 {
 // look for a number match in this ch column
 if (Table[Trow][Tcol].nums[Brow][Bcol] == num
 && Table[Trow][Tcol].letters[Bcol] == ch)
 {
 Table[Trow][Tcol].visflag[Brow][Bcol] = 0;
 found++;
 // check for BINGO (an entire column filled)
 if (!bingo) // neglect previous bingo from some other board
 {
 bingo = 64; // assume bingo! (a power of 2 bitflag)
 // for each Brow
 for (i = 0; i < 5; i++)
 if (Table[Trow][Tcol].visflag[i][Bcol] != 0)
 bingo = 0; // alas, no bingo
 }
 }
 }
 }
 }
 }
 return found + bingo; // can take out the bingo later
 }
 /*
 Le main
 */
 void main(void)
 {
 time_t t;
 // struct BingoBoard B1;
 int Trow;
 int Tcol;
 char ch;
 int num;
 int found;
 // seed generator
 srand((unsigned)time(&t));
 // initialize and print one board for testing
 //initBoard(&B1);
 //printBoard(B1);
 // initialize the global table of boards
 for (Trow = 0; Trow < TROWS; Trow++)
 for (Tcol = 0; Tcol < TCOLS; Tcol++)
 initBoard(&Table[Trow][Tcol]);
 // array version needs this ugly typecast:
 // initBoard((char (*)[5]) Table[Trow][Tcol]);   
 printTable();
 // main game loop
 do
 {
 // prompt user for next move
 printf(\"DRAW! Example N5 (Q to quit): \");
 // get move from user
 ch = getche();
 if (ch == \'Q\')break; // terminate main loop
 scanf(\"%d\", &num);
 // play this user move
 found = play(ch, num);
 printTable();
 // check for Bingo
 if (found >= 64)
 {
 printf(\"BINGO!!!! \");
 found -= 64; // take out the bitflag
 }
 // print results
 if (found)
 printf(\"%d occurance of %c%d found. \", found, ch, num);
 else
 printf(\"%c%d not found. \", ch, num);
 } while (1);
 printf(\"\ \");
 }









