Never Hide
Registered User.
- Local time
- Today, 07:18
- Joined
- Dec 22, 2011
- Messages
- 96
Hello all,
I have a 2D array, 1st column holds dates and the 2nd one holds ones and zeros. The 1st column is the duration of the stay of someone in a hotel and the 2nd column determines if at the given date that person's room need to be cleaned(1) or not(0). Now, if the day that the room is supposed to be cleaned happens to be Sunday, then I move the "1" from that row, to the next row.
A little visual might help a bit here(for simplicity's sake I just used M-Monday,T-Tuesday etc)
Now what I would like to do is instead of just changing the Sunday to 0 and Monday to 1, I'd like to push the array's elements from Sunday till the end, to the next position.
So something like this
Please let me know if this isn't clear enough so I'll try to explain it better
I have a 2D array, 1st column holds dates and the 2nd one holds ones and zeros. The 1st column is the duration of the stay of someone in a hotel and the 2nd column determines if at the given date that person's room need to be cleaned(1) or not(0). Now, if the day that the room is supposed to be cleaned happens to be Sunday, then I move the "1" from that row, to the next row.
A little visual might help a bit here(for simplicity's sake I just used M-Monday,T-Tuesday etc)
Code:
[B]The default After I make the changes[/B]
Date |Cleaning ----> Date |Cleaning
M |0 M |0
T |1 T |1
W |0 W |0
T |0 T |0
F |0 F |0
S |0 S |0
[COLOR="Red"]S |1 S |0[/COLOR]
[COLOR="red"]M |0 M |1[/COLOR]
T |1 T |1
W |0 W |0
Now what I would like to do is instead of just changing the Sunday to 0 and Monday to 1, I'd like to push the array's elements from Sunday till the end, to the next position.
So something like this
Code:
[B]The default After I make the changes[/B]
Date |Cleaning ----> Date |Cleaning
M |0 M |0
T |1 T |1
W |0 W |0
T |0 T |0
F |0 F |0
S |0 S |0
[COLOR="Red"]S |1 S |0[/COLOR]
[COLOR="red"]M |0 M |1[/COLOR]
T |1 T |0
W |0 W |1
Please let me know if this isn't clear enough so I'll try to explain it better