I need to use the rand() function for my program. But it isn't working the way I want.
I think the code is now generating a number between the number choice[8] contains and a number choice[0] contains. But I want to get a number amongst these :1,2,3,5,6,7,8,9. Does anyone has a solution for this?
I'm not very good in English so please reply if you don't understand me.
int choice[8]={1,2,3,5,6,7,8,9};
srand(time (NULL));
number[0]=rand() % choice[8] + choice[0];


Sign In
Create Account

Back to top









