I want to assign values to a boolean array. I want the program to remember these values.
For example, 5 seats in a cinema. this is an array cinema[5];
I want to be able for the program to show all seats as 0 stating false.
Then as a seat gets taken, an element of the array becomes 1 true which will state its been booked already.
Can someone provide me information on this, i have gone through websites, youtube videos and some books i own but could not a get a clear answer
many thanks
Bill Thompson
I've never heard of a boolean array but presumably it will hold only 0 and 1 so it is really an array of type int.
If you initialize it as int bool_array[5]={0};it will hold 5 '0`s'.
When a seat is booked you can direct access bool_array by [index] and change bool_array [index] by assigning 1 to this array element.
If you print the array using a loop it will show the reserved versus unreserved seats with '0' and'1'.
hth`s