can you help me to fix my program? how can i non-repeat the numbers i don't know the code..and how can i generate a numbers for bingo?...i need to generate until i win..

#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

const int ROWS = 5;
const int COLUMNS = 5;
     
int main()
{


cout << "  B 	  I 	  N 	  G 	  O\n\n";
srand(time(0));
int   card[ROWS][COLUMNS] = {{rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61},					
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61},
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31 ,rand() % 15 + 46, rand() % 15 + 61},						
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61},		
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61}};
	

for (int i = 0; i < ROWS; i++)
	{
        for (int j = 0; j < COLUMNS; j++)
			{
			cout << card[i][j];
			cout << "\t|"; 		
        }
		cout <<"\n";
	}
    system("pause");
    	}
srand(time(0));
int   card[ROWS][COLUMNS] = {{rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61},					
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61},
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31 ,rand() % 15 + 46, rand() % 15 + 61},						
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61},		
                            {rand() % 15 + 1, rand() % 15 + 16, rand() % 15 + 31, rand() % 15 + 46, rand() % 15 + 61}};

I'm assuming your problem is here. You could use for loops to iterate through the 2 d array and set each value independently, instead of setting the whole array at once. Then to make sure you haven't duplicated any you could check each value generated with the previously generated values. Take a look at subscripting 2 dimensional arrays here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.