Hy I have a problem with my school project. I need a program to generate random numbers, in predefined colums and rows. The problem is that the program only generates row numbers once and not how many times you define it.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <iostream>
usingnamespace std;
int main ()
{
int n, kombi, stevilo, x, y;
srand (time(NULL)); //random seed
x=0;
y=0;
printf ("Vpišite željeno količino številk: "); //you enter how many numbers you want in one row
scanf ("%d",&stevilo);
printf ("Vpišite število kombinacij: "); //you enter how many colums you want
scanf ("%d",&kombi);
do {
if (y<kombi) //if - to jump to new line
{
cout<<endl; //jumps to the new line
y++;
if (x<stevilo) //if - to fill the row with numbers "stevilo"
{
n = rand() % 10 + 1; //generates a random number from 1-10
cout<<n<<", "; //output the random number
x++;
}
}
} while (y<kombi);
return 0;
}