I`m trying to to use if statement but something going wrong.
statement must be 2 steps
IF There is still room in the array and
IF there is not an Appointmen on the same Date and Time!
Apointment will be accept......
im not getting any error or worning
but its not chaking second if statement and both else printing together
void addAppointmenRecords( )
{
int number, i,k;
system("cls"); //clear screen
cout<<"\nHow many Appointmen you wish to add? ";
cin>>number; //read number
cin.get(); //read newline character left in the buffer
if((number + currentSize ) <= listSize) //There is still room in the array
{
for( i = 1; i<=number; i++ )
{
cout<<"\nEnter Person name: ";
getline(cin, AppointmenList[currentSize].name);
cout<<"Enter Appointmen Descriptions: ";
getline(cin, AppointmenList[currentSize].description);
cout<<"Enter Appointmen date: ";
cin>>AppointmenList[currentSize].appdate.day;
cin>>AppointmenList[currentSize].appdate.mounth;
cin>>AppointmenList[currentSize].appdate.year;
cin.get(); //read a character
cout<<"Enter Appointmen time: ";
getline(cin, AppointmenList[currentSize].time);
cout<<endl;
currentSize += 1; //update CurrentSize
for(k=0; k<currentSize; k++) //chech if there an Appointmen on the same Date and Time!
if( AppointmenList[currentSize].appdate.day == AppointmenLis[k].appdate.day &&
AppointmenList[currentSize].appdate.mounth == AppointmenList[k].appdate.mounth &&
AppointmenList[currentSize].appdate.year == AppointmenList[k].appdate.year &&
AppointmenList[currentSize].time == AppointmenList[k].time )
{
cout<<"\nGot a match\n";
cout<<"Appointmen Date and Time already filled"<<endl;
currentSize-=1;
}
else
{
cout<<"Apointment accepted"<<endl;
currentSize+=1;
}
}
}
else
{
cout<<"Overflow!!!! Appointmen List is full"<<endl;
cout<<"\nPress any key to continue"<<endl;
cin.get(); //read a character
}
}