Bingo Programming!

Need help creating a Bingo Program in C++!?
I need to create a program that plays bingo in C++. I'm not too sure how to go about it since I'm fairly new to C++ but here's what I have so far.

#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 help is appreciated.
Thanks! =)
closed account (D80DSL3A)
What are you finding is wrong with your code?
It appears that you want to produce a bingo board and display it. Is that right?
If so, the following may work a bit better:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
int main(void)
{
	int bingo[5][5];// not currently in use
	int b[5], i[5], n[5], g[5], o[5];// a 2D array with [1] as the 1st dimension is pointless

	cout << "B" << " " << "I" << " " << "N" << " " << "G" << " " << "O" << endl;
	srand((unsigned)time(0));// seed the random number generator

	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;
	return 0;
}


EDIT: Why post this in a windows forum? It would get better attention in the Beginners forum.
Last edited on
Well now what I was having trouble with is that I need to create some way that the program actually plays the game. I understand that in order to do that, I should create a random number generator however, I'm not quite sure how to create a sort of a marker that would let you know that that number has been called or not.

I'm sorry, I wasn't quite sure where to post this =\
Topic archived. No new replies allowed.