Hey everyone! (first post Woohoo!)
So we're having an assignment for school where you code a Roulette game which simulates you playing and you can choose how many times you "play" to check how many times you'd win (if that makes any sense, im german :P)
Anyways, the problem is how do i store all the random generated numbers in an array while NOT doing this (it's just a snip):
Code:void randomzahl(void){
int i;
int zahl5[5];
int zahl10[10];
int zahl100[100];
int zahl1000[1000];
int zahl10000[10000];
if(runden == 5)
{
for(i=0; i<5; ++i)
{
zahl5[i] = rand()%37;
if(input==zahl5[i])
g++;
}
}
else if(runden == 10)
{
for(i=0;i<10;++i)
{
zahl10[i] = rand()%37;
if(input==zahl10[i])
g++;
}
}
else if(runden == 100)
{
for(i=0;i<100;++i)
{
zahl100[i] = rand()%37;
if(input==zahl100[i])
g++;
}
}
else if(runden == 1000)
{
for(i=0;i<1000;++i)
{
zahl1000[i] = rand()%37;
if(input==zahl1000[i])
g++;
}
}
else if(runden == 10000)
{
for(i=0;i<10000;++i)
{
zahl10000[i] = rand()%37;
if(input==zahl10000[i])
g++;
}
}
else
puts("Sie haben keine G\201ltige Option gew\204lt");
}