here is my real codes, if entry date and time not in the array i want to ask again till its find in array
so how im gonna do it????
Code:
void deleteAppointmentRecords( )
{
bool flag = false;
string deleteTime;
int deleteday,deletemounth,deleteyear;
int update;
system("cls"); //clear screen
cout<<"\nEnter Appointment Date you want to Delete: ";
cin>>deleteday>>deletemounth>>deleteyear;
cin.get();
cout<<"\nEnter Appointment Time you want to Delete: ";
cin>>deleteTime;
cin.get();
for(int i=0; i<currentSize; i++)
{
if (AppointmentList[i].appdate.day == deleteday &&
AppointmentList[i].appdate.mounth == deletemounth &&
AppointmentList[i].appdate.year == deleteyear &&
AppointmentList[i].time == deleteTime)
{
update = i;
system("cls"); //clear screen
displayHeading( ); //display Appointment under heading
cout<<setw(20)<<AppointmentList[update].name;
cout<<setw(23)<<AppointmentList[update].description;
cout<<AppointmentList[i].appdate.day;
cout<<"/"<<AppointmentList[update].appdate.mounth;
cout<<"/"<<setw(14)<<AppointmentList[update].appdate.year;
cout<<AppointmentList[update].time;
cout<<endl; //indicate user Appointmen will be Delete
cout<<"\n\nAppointmen Above will be Delete!!!\n"<<endl;
cout<<"\nPress any key to continue"<<endl;
cin.get();
//delete Appointmen.
for(int k=update; k<=currentSize; k++)
AppointmentList[k] = AppointmentList[k + 1];
cout<<"\nAppointment Deleted!!!\n"<<endl;
cin.get();
flag = true;
currentSize -= 1; //update CurrentSize
break;
}
}
if(!flag)
{
cout<<"\n\nThere is No Appointment on this Date and Time!!!\n";
cout<<"\nEnter new Date and Time"<<endl;
cin.get();
}
}