function asks the date and search that day day in buffer and finds and displays all
but my codes only displeying firs one,
what shoul i do????

void displayCerteinDate ( )
{ //Find records with certain Date and Display all records in same Date.

	int newday, newmounth, newyear;
	bool flag = false;
	system("cls");  //clear screen
	cout<<"\nEnter the Date You want To Display (dd mm yyy): ";
	cin>>newday>>newmounth>>newyear;
	cin.get();
	for (int i=0; i<currentSize; i++)
	if (AppList[i].appdate.day == newday &&
	    AppList[i].appdate.mounth == newmounth &&
	    AppList[i].appdate.year == newyear)
	     {
	         flag = true;
	         system("cls"); //clear screen
	         displayHeading( );
	         cout<<setw(20)<<AppList[i].name;
	         cout<<setw(23)<<AppList[i].description;
	         cout<<AppList[i].appdate.day;
	         cout<<"/"<<AppList[i].appdate.mounth;
	         cout<<"/"<<setw(14)<<AppList[i].appdate.year;
	         cout<<AppList[i].time;
	         cout<<endl<<endl;
	         cin.get();
	         break;
	     }
	if(!flag) 
		
	   {
	       cout<<"\nThere are no Appointments on This Date!!!\n"<<endl;
	       cout<<"Try with Different Date!!"<<endl;
	       cin.get();  //give the user a chance to read the output data
	       displayCerteinDate ();
	   }

Recommended Answers

All 5 Replies

where is currentSize coming from, it's not in that function.

>what shoul i do????
Post more code (preferably something bare bones so we're not overloaded with unnecessary crap). currentSize isn't even defined in that snippet.

where is currentSize coming from, it's not in that function.

currentSize is Global
my codes are working i mean its finding date in the currentSize but not displaying all the datas in the same date
its showing only first one

>its showing only first one
Then you shouldn't be breaking from the loop after the first match. :icon_rolleyes:

commented: haha, I didn't even see that, that's great. +7

>its showing only first one
Then you shouldn't be breaking from the loop after the first match. :icon_rolleyes:

if i take off the break; its looping but its not displaying under the same hader. mean if are 10 record for same date need the pres enter 10 times

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.