Write in C Language please: Write a program that will prompt the user for the nu
ID: 3589877 • Letter: W
Question
Write in C Language please:
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.
Must have:
appropriate prompts to get input (number users, number cards, info about which card to print)
reading in input from user (number users, number cards, info about which card to print)
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
printing bingo cards to screen
histogram
Explanation / Answer
#include,stdio.h>
#include<randomnumber.h>
#include<unusednumbers.h>
#include<conio.h>
#include<globals.h>
int main()
{
int iseed;
char finitial,linitial,player1;
printf(("enter finitial");
scanf("%d",finitial);
printf("enter linitial);
scanf("%d",linitial);
intRandom();
newcard();
displaycard();
int count;
count=0;
while(i<25){
rand(time(NULL));
iseed=rand()%75+1;
printf("calling first number: %d ",issed);
if(iseed==marked_val){
printf("**");
i=i+1;
}
}
printf("thankyou");
system(pause");
}
second part of the code for card:
#include<stdio.h>
#define marked_value 0
int bingocard[NUMROWS][NUMCOL];
void newcard(void){
int choice=multiple;
int row,col;
int max,min;
for(col=0;col<NUMCOLS;col++)
{
min=(col*choice)+1;
max=(col+1)*choice;
for(row=0;row<NUMROWS;row++)
{
bingocard[(row/2)][(col/2)]=marked_val;
}
void printcell(int cellvalue){
printf("|");
if(cellvalue==marked_val){
printf("**");
else
{
printf("%d",cellvalue);
}
}
void displaycard(void){
int i,j;
printf("bingocard for player1");
printf("+---------------------------------+ );
printf("|B|I|N|G|O| ");
printf("+------------------------------------+ ");
for(i=0;i<NUMROWS;i++){
for(j=0;j<NUMCOLS;j++){
printcell(bingocard[i][j]);
}
printf(" -------------------------------- ");
}
}
for generating randomcards:
void initrandom(void){
unsigned int iseed=(unsigned)time(null);
srand(iseed);
}
int myrandom(int low,int high){
return (low+rand()%(high-low+1));
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.