I've asked this before but I've decided to make a new one since it gets far too complicated and I want it simple.
This program has to be done with array, no database.
Example:
1)User A validates himself
2)Book a room
3)an array in that room number is filled with a value, rendered it as unavailable
1)User B comes, validates himself
2)Book a room
3)Try to book same room as user A, but that particular array have been altered, making it unavailable
4) Prompt message is given and it loops to the first booking question
VB Code:
Dim guest(2) As String Dim room(2) As String Dim i As Integer guest(0) = "a" guest(1) = "b" guest(2) = "c" 'pretends that there is calculation that 'validates the user here room(0) = "1" room(1) = "2" room(2) = "3" 'Following instruction is what i'm trying to do room = InputBox("enter a room") 'using boolean, if room selected is 1-2 'a special value (anything) is inserted in that 'room array so that it cannot be used by the 'next user 'If rooom is booked, a prompt message is 'given and process starts again with 'booking room
If it's helpful, here is part of the pseudocode:
VB Code:
boolean isIndexFull(integer index) if array[index] == marker return true else return false end if
Please note that this is a mock part of my program and I have spent considerable time figuring this out. Being a newbie, I am totally clueless in how array works and have spent more than 3 hours on this part of code alone with no avail. I'm not trying to get the easy way out.




Reply With Quote