Question: The program is a single row bingo row that you have to either randomly generate numbers to each letter or have the user input it.

The program is a single row bingo row that you have to either randomly generate numbers to each letter or have the user input it. That is the jist of the program but I need help getting the whole thing to run properly. If someone can fix it and working it'll be instant thumbs up!

#include

#include

#include

int main(){

printf("Welcome to Single row Bingo ");

printf("How would you like to create your Bingo card");

printf(" 1 - user entered 2 - Randomly generated. ");

printf("Please enter your choice:");

int choice;

int B,I,N,G,O;

scanf("%d",&choice);

if(choice==1){

printf(" Generating your card from user input...");

do{

printf(" Enter a number[01-15] for B:");

scanf("%d",&B);

}while(B<1 || b>15);

do{

printf(" Enter a number [16-30] for I:");

scanf("%d",&I);

}while(I<16 || i>30);

do{

printf(" Enter a number[31-45] for N:");

scanf("%d",&N);

}while(N<31 || n>45);

do{

printf(" Enter a number[46-60] for G:");

scanf("%d",&G);

}while(G<46 || g>60);

do{

printf(" Enter a number[61-75] for O:");

scanf("%d",&O);

}while(O<61 || o>75);

printf(" Your BINGO card is: B%d I%d N%d G%d O%D",B,I,N,G,O);

}else if (choice==2){

printf(" Randomly generating your card...");

\\ Use current time as seed for random generator srand(time(0));

\ andom

B = getRandom(1,15);

I = getRandom(16,30);

N = getRandom(31,45);

O = getRandom(61,75);

printf(" Your Bingo card is: B%02d I%d N%d G%d O%d",B,I,N,G,O);

}else{

return -1;

}

printf(" Now, Let's play single row BINGO! ");

printf("How many BINGO calls do you want? ");

int calls = 0;

scanf("%d",&calls);

printf("The %d BINGO calls are: ", calls);

int arr[76}={0},i=0

int hits=0;

for(i=o;i

{

int call = getRandom(1,75);

\\array is used to supress already called BNGO calls and generate a new BINGO call while(arr[call]==1)

{

call = getRandom(1,75);

}

arr[call]=1

if(call>=1 && call<=15)

{

printf("B%d",call);

}

else if(call>=16 && call<=30)

{

printf("I%d",call);

}

else if(call>=31 && call<=45)

{

printf("N%d",call);

}

else if(call>=46 && call<=60)

{

printf("G%d",call);

}

\\checking for a BINGO match if(call == B || call == I || call == N || call == G || call == O)

{

printf("BINGO!!! ");

hits += 1:

}

else{

printf(" ");

}

}

printf(" Game Summary: ");

printf("After %d BINGO ! ", hits);

printf("You had %d BINGO ! ", hits);

printf("You got a BINGO %f of the time ",(hits/(float)calls)*100);

printf("Thanks for playing. Goodbye. ");

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!