Home > Back-end >  When doing theater seat selection system, how to realize and has been selected choose seat
When doing theater seat selection system, how to realize and has been selected choose seat

Time:10-15

The seat of interval of at least two seats

CodePudding user response:

The title and the back of the subject to understand this problem,,,,
The same line, the method of soil is polling bai, seat number + 2, 2 (regardless of the column) has selected give up, the next point to continue (can be optimized to find the next point method),

Combined with the processing of boundary and column, a bit tedious, but are not difficult,

CodePudding user response:

To apply for a two dimensional array, each element and seats are one-to-one correspondence, for there is no seat, marked negative, was not chosen for the seat, marked 0, to choose a seat, mark 1, according to choice of seats, traverse the array, depending on the array elements, the corresponding icon is displayed in the corresponding seats

CodePudding user response:

Define a bitmap, add tags, 0/1, 0 say not choose, 1 choice, that sounds like the memory that judgment used and unused,

CodePudding user response:

With a regular expression match

CodePudding user response:

Can consider to do ~ have chosen to do the marking, already marked cannot choose ~
  • Related