Skip to content

Instantly share code, notes, and snippets.

@Angel-Rojas
Created August 20, 2015 07:51
Show Gist options
  • Save Angel-Rojas/f18bc441f4cfde485eea to your computer and use it in GitHub Desktop.
Save Angel-Rojas/f18bc441f4cfde485eea to your computer and use it in GitHub Desktop.
This is my turn-in script for AICS Bakersfield College Club :) Bingo Card Generator.
/*
* This script generates a simple, but nice (sorta) Bingo Card!
*
* Author: Angel Rojas
* Created on: Aug 20, 2015
* Source file: BingoCard.cpp
*/
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int main() {
cout << " B I N G O ";
cout << endl;
/*
* @srand: the 'srand' command makes it so we have a different
* value each time
*/
srand((unsigned) time(0));
int random_integer;
int row, column;
for (row = 0; row < 5; row++) {
for (column = 0; column < 5; column++) {
random_integer = (rand() % 99) + 1;
cout << "[" << random_integer << ']';
cout << ' ';
if (row == 2 && column == 1) {
cout << "FREE ";
}
if (row == 2 && column == 3) {break;}
}
cout << endl;
}
}
@Angel-Rojas
Copy link
Author

Output will look something like this:
B I N G O
[95] [87] [43] [19] [22]
[95] [53] [22] [23] [37]
[47] [89] FREE [23] [78]
[93] [89] [58] [19] [92]
[68] [89] [15] [2] [20]

@pathawks
Copy link

This is pretty sweet! 👍

I like how simple it is. The way you handle the free space amuses me 😸

I'm glad to see you've still got it! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment