it will take a random number, divide it by 4 displaying the remainder which will be 0-3.. add the +1 at the beginning that way it will 1-4, at least what I am understanding from my book anyhow.
@ Grey Wolf
It works but i still don't understand how to use it...
I'm trying to make something like random card generator for a Blackjack program I'm trying to make xD...
It looks like this so if you could help I would really appreciate your help...
OMG I can't believe I didn't put double ==...
*ashamed*
Ty man =)...
P.S.Since you can see I am total noob could you possibly explain me how to use switch?
switch( Variable )
{
case 1:
//Variable == 1
break;//as you have to put break you don't need braces
case 2: //if the break is not found it will perform the next case
case 3:
//Variable == 2 || Variable == 3
break;
default:
//All other values
}
OK ty I get it now...
I made FINALLY that random card generator and I made a "Hit" like in BJ...
The problem is that i don't know where to define points = 0 because if I don't points get messed up and if I define them in void they always get restarted but if I define points value in main function, void doesn't recognize it... HELP!!!!
Btw, this is still in If-Else form, I'll fix it afterward I'm too lazy to do it now =P
I think I've done most of it I would just appreciate if someone could explain me how to use switches instead of else-ifs and how to make cards not so repetitive and also, the most important, HOW TO DISABLE MAKING SAME CARDS MULTIPLE TIMES???
i.e.
Spade 2
Spade 2
Club 2
Heart 5
Spade 2
etc...