//Bingo
#include <iostream>
#include <ctime>
#include <iomanip>
#include <cstdlib>
using namespace std;
int cat;
int bingo [5][5];
int main()
{
int randomNumber = rand(); // generate random number
int die = (randomNumber % 75) + 1; // get a number between 1 and 75
column B 1 - 15
column I 16 - 30
column N 31 - 45
column G 46 - 60
column O 61 - 75
cin >> cat;
return 0;
}
I need some help with Bingo written in C++If anyone can help me, it you would be much appreciated
Page 1 of 1
4 Replies - 698 Views - Last Post: 04 March 2009 - 09:03 PM
#1
I need some help with Bingo written in C++
Posted 03 March 2009 - 08:23 PM
Ok, I have to write a program for Bingo. I dont have much to start with, but see if you can help me.
Replies To: I need some help with Bingo written in C++
#2
Re: I need some help with Bingo written in C++
Posted 03 March 2009 - 08:26 PM
** Renamed title to be more descriptive **
What do you need help with... you just posted some code. Please try to be a little more specific
What do you need help with... you just posted some code. Please try to be a little more specific
#3
Re: I need some help with Bingo written in C++
Posted 03 March 2009 - 09:14 PM
[rules][/rules]
What no2pen said.
What no2pen said.
#4
Re: I need some help with Bingo written in C++
Posted 04 March 2009 - 08:39 PM
Okay, now I need help with getting the prgram to give a random number generator to generate numbers like from say 16-30 like for each letter on bingo.
//Bingo
#include <iostream>
#include <ctime>
#include <iomanip>
#include <cstdlib>
using namespace std;
int cat;
int bingo [5][5];
int main()
{
cout << " Welcome to BINGO! \n\n\n\n\n" << endl;
cout << "\n\n\ B | I | N | G | O |\n - - - - - - - - - - - " << endl;
int randomNumber = rand(); // generate random number
int die = (randomNumber % 75) + 1; // get a number between 1 and 75
char board[5][5];{
board [0][0] = (randomNumber % 15) + 1;
board [1][0] = (randomNumber % 15) + 1;
board [2][0] = (randomNumber % 15) + 1;
board [3][0] = (randomNumber % 15) + 1;
board [4][0] = (randomNumber % 15) + 1;
board [0][1] = (randomNumber % 30) + 1;
board [1][1] = (randomNumber % 30) + 1;
board [2][1] = (randomNumber % 30) + 1;
board [3][1] = (randomNumber % 30) + 1;
board [4][1] = (randomNumber % 30) + 1;
board [0][2] = (randomNumber % 45) + 1;
board [1][2] = (randomNumber % 45) + 1;
board [2][2] = (randomNumber % 45) + 1;
board [3][2] = (randomNumber % 45) + 1;
board [4][2] = (randomNumber % 45) + 1;
board [0][3] = (randomNumber % 60) + 1;
board [1][3] = (randomNumber % 60) + 1;
board [2][3] = (randomNumber % 60) + 1;
board [3][3] = (randomNumber % 60) + 1;
board [4][3] = (randomNumber % 60) + 1;
board [0][4] = (randomNumber % 75) + 1;
board [1][4] = (randomNumber % 75) + 1;
board [2][4] = (randomNumber % 75) + 1;
board [3][4] = (randomNumber % 75) + 1;
board [4][4] = (randomNumber % 75) + 1;
}
cin >>cat;
return 0;
}
#5
Re: I need some help with Bingo written in C++
Posted 04 March 2009 - 09:03 PM
I suggest you write a function that generates a random number in a specified range, e.g.,
I would also suggest you use a loop to initialize the board array.
int getRandomNumber(int min, int max)
{
int number;
number = (rand() % ((max - min) + 1)) + min;
return number;
}
.I would also suggest you use a loop to initialize the board array.
This post has been edited by bsaunders: 04 March 2009 - 09:29 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|