i couldnt figure out this any help anyone?????
it should checked if there an Appointment on the same Date and Time! but its not. i can still put more then 1 record on the same date and time????
void addAppRecords( )
{
int number;
system("cls"); //clear screen
cout<<"\nHow many Appointments do 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(int i = 1; i<=number; i++)
{
cout<<"\nEnter Person name: ";
getline(cin, AppList[currentSize].name);
cout<<"Enter Appointment Descriptions: ";
getline(cin, AppList[currentSize].description);
cout<<"Enter Appointment date: ";
cin>>AppoList[currentSize].appdate.day;
cin>>AppList[currentSize].appdate.mounth;
cin>>AppList[currentSize].appdate.year;
cin.get(); //read a character
cout<<"Enter Appointment time: ";
getline(cin, AppointmentList[currentSize].time);
cout<<endl;
currentSize += 1; //update CurrentSize
for(int k=0; k<=currentSize; k++)
{ //check if there an Appointment on the same Date and Time!
if(AppList[currentSize].appdate.day == AppList[k].appdate.day &&
AppList[currentSize].appdate.mounth == AppList[k].appdate.mounth &&
AppList[currentSize].appdate.year == AppList[k].appdate.year &&
AppList[currentSize].time == AppList[k].time )
{
cout<<"\nGot a match\n";
cout<<"Appointment Date and Time already filled"<<endl;
currentSize -= 1; //update CurrentSize
cin.get();
}
else
{
cout<<"Apointment accepted"<<endl;
cin.get(); //read a character
break;
}
}
}
}
else
{
cout<<"Overflow!!!! Appointment List is full"<<endl;
cout<<"\nPress any key to continue"<<endl;
cin.get(); //read a character
}
}