SlideShare a Scribd company logo
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void FillBingoCard(int bingocard[5][5]);
void PrintCard(int bingocard[5][5], int called[3], char yn[1]);
int PickNumber(int called[3], int callednumber[75], int counter);
int drawnnumber(int bingocard[5][5], int called[3]);
void completedrowcolumn(int bingocard[5][5], int win);
int main(void)
{
//array of bingo numbers
int row = 5;
int col = 5;
int bingocard[row][col];
int called[3];
int counter = 0;
int callednumber[75];
char yn[1];
int win = 0;
//fill bingocard
FillBingoCard(bingocard);
//print bingocard
PrintCard(bingocard, called, yn);
//called
called[3] = PickNumber(called, callednumber, counter);
for(int i = 0; i < 75; i++)
{
callednumber[i] = 0;
}
callednumber[counter] = called[1];
printf("nThe called number is %c%dn", called[0], called[1]);
//ask player if they have chosen number on their bingo card
printf("Do you have it? (Y/N) ");
scanf(" %c", &yn[0]);
//verify
while(counter < 75)
{
int verify;
if(yn[0] == 'Y')
{
int verify = drawnnumber(bingocard, called);
if(verify == 1)
{
counter++;
PrintCard(bingocard, called, yn);
called[3] = PickNumber(called, callednumber, counter);
callednumber[counter] = called[1];
completedrowcolumn(bingocard, win);
if(win == 0)
{
printf("nThe next number is %c%dn", called[0], called[1]);
printf("Do you have it? (Y/N) ");
scanf(" %c", &yn[0]);
}
}
else
{
printf("nThat value is not on your BINGO card - are you trying to cheat?");
counter = 76;
}
}
else
{
counter++;
PrintCard(bingocard, called, yn);
called[3] = PickNumber(called, callednumber, counter);
callednumber[counter] = called[1];
printf("nThe next number is %c%dn", called[0], called[1]);
printf("Do you have it? (Y/N) ");
scanf(" %c", &yn[0]);
}
}
if(counter == 75)
{
printf("There are no other numbers to call left.");
}
return (0);
}
void FillBingoCard(int bingocard[5][5])
{
srand(time(0));
int row, col;
int counter = 0;
for(col = 0; col < 5; col++)
{
for(row = 0; row < 5; row++)
{
if(col == 0)
{
bingocard[row][0] = (rand() % 15) + 1;
}
if(col == 1)
{
bingocard[row][1] = (rand() % 15) + 16;
}
if(col == 2)
{
bingocard[row][2] = (rand() % 15) + 31;
}
if(col == 3)
{
bingocard[row][3] = (rand() % 15) + 46;
}
if(col == 4)
{
bingocard[row][4] = (rand() % 15) + 61;
}
for(int counter = 0; counter == 0; counter = counter)
{
int check = 5;
for(int i = 0; i < 5; i++)
{
if(bingocard[row][col] == bingocard[i][col])
{
if(col == 0)
{
bingocard[row][0] = (rand() % 15) + 1;
}
if(col == 1)
{
bingocard[row][1] = (rand() % 15) + 16;
}
if(col == 2)
{
bingocard[row][2] = (rand() % 15) + 31;
}
if(col == 3)
{
bingocard[row][3] = (rand() % 15) + 46;
}
if(col == 4)
{
bingocard[row][4] = (rand() % 15) + 61;
}
}
}
for(int j = 0; j < 5; j++)
{
if(bingocard[row][col] != bingocard[j][col])
{
check--;
}
}
if(check == 1)
{
counter++;
}
}
}
}
bingocard[2][2] = 0;
}
void PrintCard(int bingocard[5][5], int called[3], char yn[1])
{
int row, col;
printf("%5c%8c%8c%8c%8cn-----------------------------------------n", 66, 73, 78, 71, 79);
for(row = 0; row < 5; row++)
{
for(col = 0; col < 5; col++)
{
if(yn[0] == 'Y')
{
if(called[1] == bingocard[row][col])
{
bingocard[row][col] = 0;
}
}
if(bingocard[row][col] == 0)
{
printf("|%4c%3c", 88, 32);
}
else
{
printf("|%4d%3c", bingocard[row][col], 32);
}
}
printf("|");
printf("n-----------------------------------------n");
}
}
int PickNumber(int called[3], int callednumber[75], int counter)
{
srand(time(0));
int duplicate = 75;
while(duplicate == 75)
{
called[1] = (rand() % 75) + 1;
callednumber[counter] = called[1];
for(int i = 0; i < 75; i++)
{
if(callednumber[counter] == callednumber[i])
{
called[1] = (rand() % 75) + 1;
callednumber[counter] = called[1];
}
}
for(int j = 0; j < 75; j++)
{
if(callednumber[counter] != callednumber[j])
{
duplicate--;
}
}
if(duplicate == 1)
{
duplicate = 1;
}
else
{
duplicate = 75;
}
}
if(called[1] < 16)
{
called[0] = 66;
}
else
{
if(called[1] < 30)
{
called[0] = 73;
}
else
{
if(called[1] < 45)
{
called[0] = 78;
}
else
{
if(called[1] < 60)
{
called[0] = 71;
}
else
{
if(called[1] < 75)
{
called[0] = 79;
}
}
}
}
}
return(called[3], callednumber[75]);
}
int drawnnumber(int bingocard[5][5], int called[3])
{
int check;
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
if(called[1] == bingocard[j][i])
{
check++;
}
}
}
return(check);
}
void completedrowcolumn(int bingocard[5][5], int win)
{
int col_win[5];
int row_win[5];
int rowcounter = 0;
int colcounter = 0;
//col_win
for(int k = 0; k < 5; k++)
{
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
if(bingocard[j][i] == 0)
{
col_win[k]++;
}
}
}
}
//row_win
for(int k = 0; k < 5; k++)
{
for(int i = 0; i < 5; i++)
{
for(int j = 0; j < 5; j++)
{
if(bingocard[i][j] == 0)
{
row_win[k]++;
}
}
}
}
//win
for(int i = 0; i < 5; i++)
{
if(row_win[i] == 5)
{
rowcounter++;
}
if(col_win[i] == 5)
{
colcounter++;
}
}
if(rowcounter == 1 && colcounter == 1)
{
printf("You filled out a row and a column - BINGO!!!");
}
else
{
if(rowcounter == 1 && colcounter == 0)
{
printf("You filled out a row - BINGO!!!");
}
else
{
if(rowcounter == 0 && colcounter == 1)
{
printf("You filled out a column - BINGO!!!");
}
}
}
}
Can someone fix this?
1.) It needs to include the lines
2.) It needs to mark 'X' on the numbers called
3.) It should not end the game when I say 'N' to a number that isn't on my card. It should also not
end my game and say I'm cheating when I say 'Y' to a number that is on my card. It should print
out exactly like the photo attached-- lines and everything.
The next number is 065 Do you have it? (Y/N)Y That value is not on your BINGo card - are you
trying to cheat??

More Related Content

PDF
include ltstdiohgtinclude ltstdlibhgtinclude l.pdf
DOCX
#include -stdio-h- #include -stdlib-h- #include -stdbool-h- #include - (1).docx
PDF
#include stdio.h #include string.h #include stdlib.h #in.pdf
PDF
The following is my code for a connectn program. When I run my code .pdf
PDF
#include iostream #include string #include iomanip #incl.pdf
PDF
Python From Scratch (1).pdf
PDF
Additional_Solutions_TPEC _datastrucures.pdf
PDF
The main class of the tictoe game looks like.public class Main {.pdf
include ltstdiohgtinclude ltstdlibhgtinclude l.pdf
#include -stdio-h- #include -stdlib-h- #include -stdbool-h- #include - (1).docx
#include stdio.h #include string.h #include stdlib.h #in.pdf
The following is my code for a connectn program. When I run my code .pdf
#include iostream #include string #include iomanip #incl.pdf
Python From Scratch (1).pdf
Additional_Solutions_TPEC _datastrucures.pdf
The main class of the tictoe game looks like.public class Main {.pdf

Similar to include ltstdiohgt include ltstdlibhgt include .pdf (17)

PDF
ANS#include iostream int Rn_get(int low, int high); int cva.pdf
PDF
codes.txt.pdf code presentation engineering
PPS
pointers 1
PPTX
Counting Sort
PDF
GameOfLife.cs using System; using System.Collections.Generic;.pdf
PDF
PDF
COA_remaining_lab_works_077BCT033.pdf
PDF
Algoritmo Counting sort
DOCX
Boundary Fill Algorithm in C
PDF
11 1. multi-dimensional array eng
PDF
C programs
PDF
AI_Lab_File()[1]sachin_final (1).pdf
PDF
Flood Filling Algorithm in C
DOCX
Tik tic tok
PDF
C++ Programming From Problem Analysis to Program Design 7th Edition Malik Tes...
PDF
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018
ANS#include iostream int Rn_get(int low, int high); int cva.pdf
codes.txt.pdf code presentation engineering
pointers 1
Counting Sort
GameOfLife.cs using System; using System.Collections.Generic;.pdf
COA_remaining_lab_works_077BCT033.pdf
Algoritmo Counting sort
Boundary Fill Algorithm in C
11 1. multi-dimensional array eng
C programs
AI_Lab_File()[1]sachin_final (1).pdf
Flood Filling Algorithm in C
Tik tic tok
C++ Programming From Problem Analysis to Program Design 7th Edition Malik Tes...
Lab programs FOR 8TH SEM EC SUBJECT BY LOHITH KUMAR |11GUEE6018

More from adisainternational (20)

PDF
Insert a function in cell D11 to display the ltem name based.pdf
PDF
Insert Document To Collection nbdaproject36vents VIEW P.pdf
PDF
innervates posterior 13 of tongue taste 2 Wordscran.pdf
PDF
Individually look for the Code of Conduct of a selected comp.pdf
PDF
Influenza is an infectious respiratory disease caused by a .pdf
PDF
Informacin general Anna ha estado hablando con los director.pdf
PDF
inflation in india interest rates in india and compare it wi.pdf
PDF
Indigenous Peoples and Environmental Sustainability Article .pdf
PDF
Information Security Problem a Give the public and private.pdf
PDF
Infertility and Hypothyroidism Patient ProfileMB is a 29y.pdf
PDF
inet at pemoning Bret is Bhen the nol asd atenene irpuinise .pdf
PDF
Indique el diagnstico ms preciso posible Luego indique la.pdf
PDF
In user interface design what is typically TRUE Group of a.pdf
PDF
include ltinitializer_listgt include ltiostreamgt .pdf
PDF
In your opinion What would drive your decisions If you wer.pdf
PDF
Income statement for 2016 Sales are expected to increase by .pdf
PDF
Indicate in the figure below the location of the Stratosphe.pdf
PDF
Independent ttest Dependentpaired ttest Oneway ANOVA Two.pdf
PDF
Independent Assortment Two genes Dumb d and Anxious a .pdf
PDF
incubation limes that rimake up the middle 97 Cick the icon.pdf
Insert a function in cell D11 to display the ltem name based.pdf
Insert Document To Collection nbdaproject36vents VIEW P.pdf
innervates posterior 13 of tongue taste 2 Wordscran.pdf
Individually look for the Code of Conduct of a selected comp.pdf
Influenza is an infectious respiratory disease caused by a .pdf
Informacin general Anna ha estado hablando con los director.pdf
inflation in india interest rates in india and compare it wi.pdf
Indigenous Peoples and Environmental Sustainability Article .pdf
Information Security Problem a Give the public and private.pdf
Infertility and Hypothyroidism Patient ProfileMB is a 29y.pdf
inet at pemoning Bret is Bhen the nol asd atenene irpuinise .pdf
Indique el diagnstico ms preciso posible Luego indique la.pdf
In user interface design what is typically TRUE Group of a.pdf
include ltinitializer_listgt include ltiostreamgt .pdf
In your opinion What would drive your decisions If you wer.pdf
Income statement for 2016 Sales are expected to increase by .pdf
Indicate in the figure below the location of the Stratosphe.pdf
Independent ttest Dependentpaired ttest Oneway ANOVA Two.pdf
Independent Assortment Two genes Dumb d and Anxious a .pdf
incubation limes that rimake up the middle 97 Cick the icon.pdf

Recently uploaded (20)

PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
master seminar digital applications in india
PDF
Computing-Curriculum for Schools in Ghana
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Lesson notes of climatology university.
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
A systematic review of self-coping strategies used by university students to ...
DOC
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Classroom Observation Tools for Teachers
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
master seminar digital applications in india
Computing-Curriculum for Schools in Ghana
FourierSeries-QuestionsWithAnswers(Part-A).pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Microbial disease of the cardiovascular and lymphatic systems
Supply Chain Operations Speaking Notes -ICLT Program
Abdominal Access Techniques with Prof. Dr. R K Mishra
Lesson notes of climatology university.
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
A systematic review of self-coping strategies used by university students to ...
Soft-furnishing-By-Architect-A.F.M.Mohiuddin-Akhand.doc
O7-L3 Supply Chain Operations - ICLT Program
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Orientation - ARALprogram of Deped to the Parents.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Anesthesia in Laparoscopic Surgery in India
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Classroom Observation Tools for Teachers

include ltstdiohgt include ltstdlibhgt include .pdf

  • 1. #include <stdio.h> #include <stdlib.h> #include <time.h> void FillBingoCard(int bingocard[5][5]); void PrintCard(int bingocard[5][5], int called[3], char yn[1]); int PickNumber(int called[3], int callednumber[75], int counter); int drawnnumber(int bingocard[5][5], int called[3]); void completedrowcolumn(int bingocard[5][5], int win); int main(void) { //array of bingo numbers int row = 5; int col = 5; int bingocard[row][col]; int called[3]; int counter = 0; int callednumber[75]; char yn[1]; int win = 0; //fill bingocard
  • 2. FillBingoCard(bingocard); //print bingocard PrintCard(bingocard, called, yn); //called called[3] = PickNumber(called, callednumber, counter); for(int i = 0; i < 75; i++) { callednumber[i] = 0; } callednumber[counter] = called[1]; printf("nThe called number is %c%dn", called[0], called[1]); //ask player if they have chosen number on their bingo card printf("Do you have it? (Y/N) "); scanf(" %c", &yn[0]); //verify while(counter < 75) { int verify; if(yn[0] == 'Y') { int verify = drawnnumber(bingocard, called);
  • 3. if(verify == 1) { counter++; PrintCard(bingocard, called, yn); called[3] = PickNumber(called, callednumber, counter); callednumber[counter] = called[1]; completedrowcolumn(bingocard, win); if(win == 0) { printf("nThe next number is %c%dn", called[0], called[1]); printf("Do you have it? (Y/N) "); scanf(" %c", &yn[0]); } } else { printf("nThat value is not on your BINGO card - are you trying to cheat?"); counter = 76; } } else
  • 4. { counter++; PrintCard(bingocard, called, yn); called[3] = PickNumber(called, callednumber, counter); callednumber[counter] = called[1]; printf("nThe next number is %c%dn", called[0], called[1]); printf("Do you have it? (Y/N) "); scanf(" %c", &yn[0]); } } if(counter == 75) { printf("There are no other numbers to call left."); } return (0); } void FillBingoCard(int bingocard[5][5]) { srand(time(0)); int row, col;
  • 5. int counter = 0; for(col = 0; col < 5; col++) { for(row = 0; row < 5; row++) { if(col == 0) { bingocard[row][0] = (rand() % 15) + 1; } if(col == 1) { bingocard[row][1] = (rand() % 15) + 16; } if(col == 2) { bingocard[row][2] = (rand() % 15) + 31; } if(col == 3) { bingocard[row][3] = (rand() % 15) + 46; }
  • 6. if(col == 4) { bingocard[row][4] = (rand() % 15) + 61; } for(int counter = 0; counter == 0; counter = counter) { int check = 5; for(int i = 0; i < 5; i++) { if(bingocard[row][col] == bingocard[i][col]) { if(col == 0) { bingocard[row][0] = (rand() % 15) + 1; } if(col == 1) { bingocard[row][1] = (rand() % 15) + 16; } if(col == 2) {
  • 7. bingocard[row][2] = (rand() % 15) + 31; } if(col == 3) { bingocard[row][3] = (rand() % 15) + 46; } if(col == 4) { bingocard[row][4] = (rand() % 15) + 61; } } } for(int j = 0; j < 5; j++) { if(bingocard[row][col] != bingocard[j][col]) { check--; } } if(check == 1) {
  • 8. counter++; } } } } bingocard[2][2] = 0; } void PrintCard(int bingocard[5][5], int called[3], char yn[1]) { int row, col; printf("%5c%8c%8c%8c%8cn-----------------------------------------n", 66, 73, 78, 71, 79); for(row = 0; row < 5; row++) { for(col = 0; col < 5; col++) { if(yn[0] == 'Y') { if(called[1] == bingocard[row][col]) { bingocard[row][col] = 0; }
  • 9. } if(bingocard[row][col] == 0) { printf("|%4c%3c", 88, 32); } else { printf("|%4d%3c", bingocard[row][col], 32); } } printf("|"); printf("n-----------------------------------------n"); } } int PickNumber(int called[3], int callednumber[75], int counter) { srand(time(0)); int duplicate = 75; while(duplicate == 75) {
  • 10. called[1] = (rand() % 75) + 1; callednumber[counter] = called[1]; for(int i = 0; i < 75; i++) { if(callednumber[counter] == callednumber[i]) { called[1] = (rand() % 75) + 1; callednumber[counter] = called[1]; } } for(int j = 0; j < 75; j++) { if(callednumber[counter] != callednumber[j]) { duplicate--; } } if(duplicate == 1) { duplicate = 1; }
  • 11. else { duplicate = 75; } } if(called[1] < 16) { called[0] = 66; } else { if(called[1] < 30) { called[0] = 73; } else { if(called[1] < 45) { called[0] = 78; }
  • 12. else { if(called[1] < 60) { called[0] = 71; } else { if(called[1] < 75) { called[0] = 79; } } } } } return(called[3], callednumber[75]); } int drawnnumber(int bingocard[5][5], int called[3]) { int check;
  • 13. for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) { if(called[1] == bingocard[j][i]) { check++; } } } return(check); } void completedrowcolumn(int bingocard[5][5], int win) { int col_win[5]; int row_win[5]; int rowcounter = 0; int colcounter = 0; //col_win for(int k = 0; k < 5; k++)
  • 14. { for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) { if(bingocard[j][i] == 0) { col_win[k]++; } } } } //row_win for(int k = 0; k < 5; k++) { for(int i = 0; i < 5; i++) { for(int j = 0; j < 5; j++) { if(bingocard[i][j] == 0) {
  • 15. row_win[k]++; } } } } //win for(int i = 0; i < 5; i++) { if(row_win[i] == 5) { rowcounter++; } if(col_win[i] == 5) { colcounter++; } } if(rowcounter == 1 && colcounter == 1) { printf("You filled out a row and a column - BINGO!!!"); }
  • 16. else { if(rowcounter == 1 && colcounter == 0) { printf("You filled out a row - BINGO!!!"); } else { if(rowcounter == 0 && colcounter == 1) { printf("You filled out a column - BINGO!!!"); } } } } Can someone fix this? 1.) It needs to include the lines 2.) It needs to mark 'X' on the numbers called 3.) It should not end the game when I say 'N' to a number that isn't on my card. It should also not end my game and say I'm cheating when I say 'Y' to a number that is on my card. It should print out exactly like the photo attached-- lines and everything. The next number is 065 Do you have it? (Y/N)Y That value is not on your BINGo card - are you trying to cheat??