I wrote this code
to validate the time input
if there is a free slot slots array
then the time option will appear
but the code does not work properly
what is the problem??
int slotoptions[]={10,11,12};
bool slots[]={true,true,true};
cout<<"please enter the time: ";
cin>>time;
for (int i = 0; i < 3; i++)
{
if(slots[i]==true)
{
if(time==slotoptions[i])
{
a[n].time=time;
slots[i]=false;break;
}
}
if(slots[i]==false)
{
cout<<"Sorry, this is not available \n";
cout<<"please enter the time: ";
cin>>time;
}
}