I have 5 integer variables named x_1
, x_2
, x_3
, x_4
, x_5
.
int x_1, x_2, x_3, x_4, x_5;
I'm initializing those variables' values with srand().
srand(time(NULL));
x_1=rand()%10+1; x_2=rand()%10+1;
...
I need to check whether those variables contain a sequence of ascending numbers (like a straight in poker). Order doesn't matter.
For example:
x_1=3, x_2=5, x_3=1, x_4=2 x_5=4.
This should give me 1. But this should give me 0:
x_1=4, x_2=1, x_3=4 …
(I didn't complete the list because I have multiple 4's already.)
NOTE: I can't Use Arrays and Global variables.
Note: I'm sorry that I can't send full code because I don't even know where to start.