Question: C Program Write a code without using bool, return , continue, break inside the loop reate a 2 D array that will be your bingo
C Program
Write a code without using bool, return continue, break inside the loop
reate a D array that will be your bingo card. The bingo card will ONLY be
Make sure your random numbers are truly random between program
runs.
Create a function to fill the bingo card with random numbers in the
proper ranges. Pass your D bingo array to this function to be
populated. Be sure to mark the free spot.
The column contains numbers between and
The I column contains numbers between and
The N column contains numbers between and
The G column contains numbers between and
The O column contains numbers between and
These are EXAMPLE BINGO cards do
not hardcode any of the numbers in
your BINGO card every number
should random and in the correct
range.
Just a reminderBINGO numbers MUST be unique. You cannot have the same number in multiple cells of your
BINGO card. The rules of BINGO state that every number is unique. Obtaining random numbers using rand
does NOT guarantee that each number is unique YOU must check that each number is unique. If a number has
already been used, then get another number.
Create a function to print the bingo card to the screen. You must match the formatting shown in the sample output.
The bingo array must be passed to this function.
Create a function to pick a number that has not already been chosen. You will need to use a D array to keep track
of which numbers between and have been used so that you don't pick numbers that have already been called.
If you randomly pick a number that was already called, then pick another. Continue this process until you find a
number that has not been previously called. Print the number to the screen along with its corresponding letter.
This function should return that value.
Create a function to determine if a called number exists in the player's bingo card. Pass the bingo array and the
number to the function. Loop over the array nested for loops and, if the number is found in the bingo array, then
change the value to to "mark" it If the number is found, then this function should return true; otherwise, return
false.
Create a function to check for a completed row. A completed row is a row in the bingo array that has for every
value we "marked" our bingo numbers by changing the existing value to zero to indicate that the called number
matches one in our bingo card Thisfunction should check every row in the bingo array and return whether or not
it found a completed row.
Create a function to check for a completed column. A completed column is a column in the bingo array that has
for every value we "marked" our bingo numbers by changing the existing value to zero to indicate that the called
number matches one in our bingo card This function should check every column in the bingo array and return
whether or not it found a completed column.
Create a function to check for a completed diagonal. A completed diagonal is a diagonal in the bingo array that has
for every value we "marked" our bingo numbers by changing the existing value to zero to indicate that the called
number matches one in our bingo card This function should check both diagonals in the bingo array and return
whether or not it found a completed diagonal.
Pseudocode for main
main
Call function to fill bingo card
Call function to print bingo card to screen.
Open a file named "BINGO.card" with w mode
Call function to print bingo card to a file named "BINGO.card".
While the player has not gotten a row or column or diagonal and
while there are still numbers to choose from there are total
Call a function to pick a number that has not been chosen already this function returns the called
number.
Show the player the number including the B I, N G or O and ask if the player has that number on
their bingo card.
If the player answers anything other than something that begins with then reprint the bingo card
and increment the count of numbers drawn so far.
If the player answers something that begins with then
Call a function to determine if the number drawn IS a number from the bingo card.
If the function returns false, then print the message about cheating.
If the function returns true, then call a function to check for a completed row and a function
to check for a completed column and a function to check for a completed diagonal. If a
completed row andor column andor diagonal is found, then the player has won and a
message should print and the game should end.
Write the final BINGO card to the file BINGO.card.
Write the called numbers to the file BINGO.card in rows of numbers each.
HINTS
Please review the rubric about using a return inside a loop to break out of the loop and about using an arbitrary
valuesentinel value to control a loop. We went over both of these in class.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
