View Single Post
  #1  
Old 03-19-2010, 06:55 PM
TheDon's Avatar
TheDon TheDon is offline
Ghost of Diesels Past
 
Join Date: Oct 2005
Posts: 13,285
modulo operator?

ok how do you use this... I never learned this in math..ever.

I need to use it in programming to do something..


I have to take in 4 numbers into an array.. 4 "random" numbers between the values [0,5]...

so I have to "mod" the random numbers I think

that and I need to figure out why my array isnt taking in 4 values.

"

int i;
int number;
board[4];

srand(time(NULL));

for(i=0;i<4;i++)

board[i]=0;

for(i=0;i<5;i++)
{
board[number] = rand()%10;
}
"
Reply With Quote