Bingo game

Hi. I'm creating a program in c++ that plays bingo. So far I have the card, however I don't know how I can possibly create markers that would 'x' out the numbers that have already been called out. How can I make the program play the game?
Here's the code I have so far:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <ctime>
using namespace std;

int main () {
int bingo[5][5], b[1][5], i[1][5], n[1][5], g[1][5], o[1][5];


for (int y=0; y < 1; y++)
{
for (int x=0; x < 1 ; x++)
{
cout << "B" << " " << "I" << " " << "N" << " " << "G" << " " << "O";
}
cout << endl;
}


for (int y=0; y < 5; y++)
{
for (int x=0; x < 1; x++)
{
for (int x=0; x < 1; x++)
{
b[x][y] = rand()%15+1;
}
for (int x=0; x < 1; x++)
{
i[x][y] = rand()%15+16;
}
for (int x=0; x < 1; x++)
{
n[x][y] = rand()%15+31;
}
for (int x=0; x < 1; x++)
{
g[x][y] = rand()%15+46;
}
for (int x=0; x < 1; x++)
{
o[x][y] = rand()%15+61;
}
cout << b[x][y] << " " << i[x][y] << " " << n[x][y] << " " << g[x][y] << " " << o[x][y] << " ";
}
cout << endl;
}


Any ideas?
Honestly with the number of backflips and workarounds that you would have to do to get a game even as seeminly simple as "BINGO" to work you'd be far better off spending half of that time to learn how to do it in SFML.

DOWNLOAD SITE: http://www.sfml-dev.org/download.php

P.S. Most of us here can help you with questions regarding SFML or SDL if you need. They are popular libraries for beginners to use.
Last edited on
I just lost the game.

Is it just me or you have loops that run only once and two dimensional arrays with only one row? This is unnecessary, recheck your design of the bingo board. Any way, to play you should probably have a random number every turn and if it's on the board, replace it with a certain integer to mark it (say 0). Have another function to check if you won every turn.
This is how far I got. Now I'm not quite sure where to go from here =\

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <ctime>
using namespace std;

int main () {
	int bingo[5][5], b[5], i[5], n[5], g[5], o[5];
	int num, sum;

	cout << "B" << " " << "I" << " " << "N" << " " << "G" << " " << "O" << endl;

	for (int y=0; y < 5; y++)
	{
		b[y] = rand()%15 + 1;
		i[y] = rand()%15 + 16;
		n[y] = rand()%15 + 31;
		g[y] = rand()%15 + 46;
		o[y] = rand()%15 + 61;
		cout << b[y] << " " << i[y] << " " << n[y] << " " << g[y] << " " << o[y] << " " << endl;
	}
	cout << endl;

	num = rand()%75+1;

	for (int y=0; y < 5; y++)
	{
		if (b[y] == Ball)
		{
			b[y] = 0;
		}
		else if (i[y] == Ball)
		{
			i[y] = 0;
		}
		else if (n[y] == Ball)
		{
			n[y] = 0;
		}
		else if (g[y] == Ball)
		{
			g[y] = 0;
		}
		else if (o[y] == Ball)
		{
			o[y] = 0;
		}
	}
	cout << endl;
	}


Help please.
Topic archived. No new replies allowed.