思路没问题,你把menu_select()和menu_select2()这两个函数的代码贴出来,问题我已经猜到了一半,不过现在还不可说,你贴出来我看看是不是。
你把
while(strcmp(p->num,num) && p != NULL)
改成
while(p != NULL && strcmp(p->num,num))
问题在这儿,
void SEARCH()
{
...
head=NULL;
...
case 1: search1(head); break;
...
}
void search1(STUDENT *head)
{
...
p = head; /* you passed a NULL into search1 when you choose 1 */
while ( strcmp(p->num,num) && p != NULL )
...
}
你的while条件测试第一次就不成立!!!
search1()是什么东西?
把menu_select()和menu_select2()这两个函数的代码贴出来
int menu_select()
{int n;
clrscr();
printf("Welcome to the Student Score MIS\n");
printf("************************ Main Menu* *************************\n");
printf("* 1. Add Records 2. Require Records *\n");
printf("* 3. Delete Records 4. Modify Records *\n");
printf("* 5. Sort Records 6. Save Records *\n");
printf("* 7. Load Records 8. Exit *\n");
printf("*************************************************************\n");
do
{
printf("\n\t\t\tEnter your choice(1~8):");
scanf("%d",&n);
}
while(n<1||n>8);
return(n);
}
int menu_select2()
{
int n;
clrscr();
printf("*********************Require Records *************************\n");
printf("* 2.1 Require Certain Record by Num *\n");
printf("* 2.2 Require All the Records *\n");
printf("* 2.3 Back to MainMenu *\n");
printf("**************************************************************\n");
printf("\n");
printf("\n");
do
{
printf("\n\t\t\tEnter your choice(1~3):");
scanf("%d",&n);
}
while(n<1||n>3);
return(n);
}
我是楼主~~~忘记了说~~~要是在2级界面输入1的话会显示Please enter num for searching.~~这是函数search1(head);的printf语句~~~证明这个函数已经调用了吧~~~~会不会是指针的问题呢?