can any one see my mistakes for illegal else and
//chech if there an Appointmen on the same Date and Time!
seems not working
Code:
void addAppointmenRecords( )
{
int number, i;
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(int k=0; k<currentSize; k++) //chech if there an Appointmen on the same Date and Time!
if (AppointmenList[currentSize].appdate.day == AppointmenList[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;
break;
else
cout<<"Appointmen accepted"<<endl;
currentSize+=1;
}
else
cout<<"Overflow!!!! Appointmen List is full"<<endl;
cout<<"\nPress any key to continue"<<endl;
cin.get(); //read a character
}