Yo guys, I am doing a function to display selections of department for the user to input and if the department is chosen, it will then match the department with the department in the database allowing only employees within that department to be displayed, but the employees can be as much as 500 person and I want them to be displayed 10 person at a go before the user hit keypad to display the next 10 meaning to say if I have 500 employees within that department it should
display 10, 10, 10 up to the 500th employee within that department
the problem is after I inserted 21 person to check if it works it
display it display 9 person then hit it display 10 without clearscreen then 2. I wanted it to display 10 then clearscreen before it display the next 10 again.
Here are the codes :
do {
printf("\n\n 0) %s\n 1) %s\n 2) %s\n 3) %s\n 4) %s\n \n [Enter the Department to search for employee]: ", Department[0], Department[1], Department[2], Department[3], Department[4]);
fflush(stdin);
scanf("%d",&selection);
if((selection !=0) && (selection !=1) && (selection !=2) && (selection !=3) && (selection !=4)) {gotoxy(1, 24); printf(" >>invalid Department<< Retry!\a");}
} while(selection < 0 || selection > 4);
clrscr();
printf("\n\n%s%s----------\n", lines, lines);
printf("ID\tFirst Name\t\tDepartment\t\tPost\n%s%s----------\n", lines, lines);
for (i=0;i<500;i++)
{
if(strcmp(record[i].Department[storage], Department[selection])==0)
{
printf("\n\n%s\t%s %s\t\t%s\t\t%s", record[i].ID, record[i].Name, record[i].Name2, record[i].Department[storage], record[i].Post[rank]);
}
if(i%10==0)
{
getchar();
}
}
really need some help I try to include clrscr(); after the getchar() but it doesn't works thanks in advance