Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello i have a program to take make and im having difficulty making it. This is

ID: 3588191 • Letter: H

Question

Hello i have a program to take make and im having difficulty making it. This is to be done in C language.

If possible can this be done with using an Array. Thank you

Bingo Card Generator

Write a program that will

prompt the user for the number of players (maximum of 5)

prompt the user for the number of cards to generate for each player (maximum of 10)

for each card for each player, generate a valid bingo card (5 columns and 5 rows, here are some images of bingo cards

provide a menu for the user to select

which user/bingo card to display

to run a histogram on the bingo cards generated to see how many times each number between 1 and 75 appeared

http://activityconnection.com/uc/FreeBingo/Double-Cards.png

Grading:

35 points for style per @10

10 points for appropriate prompts to get input (number users, number cards, info about which card to print)

10 points reading in input from user (number users, number cards, info about which card to print)

15 points generation of valid bingo cards

appropriate values in each column (B: 1-15, I: 16-30, ...)

no repetition of values in a column

free space in the middle of the card

15 points printing bingo cards to screen

10 points histogram

Explanation / Answer

#include <stdlib.h>

int get_random_number(int min, int max) {
return min + (rand() % (max - min + 1));
}

int min_for_col(int column_index) {
return (column_index * 15) + 1;
}

int max_for_col(int column_index) {
return (column_index + 1) * 15;
}

void print_bingo_card(int cards[5][10][5][5], int player, int card) {
int i, j;
printf(" B I N G O ");
for(i = 0; i < 5; ++i) {
for(j = 0; j < 5; ++j) {
if(i == 2 && j == 2) {
printf(" ");
} else {
printf("%2d ", cards[player][card][i][j]);
}
}
printf(" ");
}
printf(" ");
}

int main() {
srand(time(NULL));
int num_players, num_cards, i, j, k, l, m, num;
int bingo_cards[5][10][5][5];
int count[75];
int num_rows = 5, num_cols = 5;
int already_exists = 0;
printf("Please enter number of players: ");
scanf("%d", &num_players);
printf("Please enter number of cards per player: ");
scanf("%d", &num_cards);
for(i = 0; i < num_players; ++i) {
for(j = 0; j < num_cards; ++j) {
for(k = 0; k < num_cols; ++k) {
for(l = 0; l < num_rows; ++l) {
while(1) {
num = get_random_number(min_for_col(k), max_for_col(k));
already_exists = 0;
for(m = 0; m < l; ++m) {
if(bingo_cards[i][j][m][k] == num) {
already_exists = 1;
}
}
if(already_exists == 0) {
break;
}
}
bingo_cards[i][j][l][k] = num;
}
}
}
}
// calculate histogram
for(i = 0; i < 75; ++i) {
count[i] = 0;
}
for(i = 0; i < num_players; ++i) {
for(j = 0; j < num_cards; ++j) {
for(k = 0; k < num_rows; ++k) {
for(l = 0; l < num_cols; ++l) {
if(!(k == 2 && l == 2)) {
count[bingo_cards[i][j][k][l] - 1]++;
}
}
}
}
}
while(1) {
printf("1. To select user/bingo card to display ");
printf("2. To show histogram ");
printf("3. Exit ");
printf("Please enter your choice: ");
scanf("%d", &i);
switch(i) {
case 1:
printf("Please enter player number(%d - %d): ", 1, num_players);
scanf("%d", &j);
printf("Please enter card number(%d - %d): ", 1, num_cards);
scanf("%d", &k);
print_bingo_card(bingo_cards, j - 1, k - 1);
break;
case 2:
for(j = 0; j < 75; ++j) {
printf("%2d: ", j + 1);
for(k = 0; k < count[j]; ++k) {
printf("*");
}
printf(" ");
}
break;
case 3:
return 0;
default:
printf("Invalid choice. Please try again!!");
break;
}
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote