舞台幕布怎么加工:error C2601: 'main' : local function definitions are illegal
来源:百度文库 编辑:高考问答 时间:2024/07/05 10:00:15
#include<stdio.h>
#include<stdlib.h>
struct student
{
char name[10];
float score;
struct student *next;
};
struct student *insert (struct student *head)
{
struct student *p,*pnew,*pold;
pnew=(struct student *)malloc (sizeof(struct student));
scanf("%s%f",pnew->name,&pnew->score);
p=head;
if(pnew->score>head->score)
{
pnew->next=head;head=pnew;
}
else
{
while(p!=NULL&&pnew->score<p->score)
{
pold=p;p=p->next;
}
return head;
}
void print (struct student *head1)
{
struct student *p=head1;
while(p!=NULL)
{
printf("%s %.f\n",p->name,p->score);
p=p->next;
}
}
struct student *pdelete(struct student *head2,char names[10])
{
struct student *p=head2,*pold=head2;
char tt[10]=names;
if(head2==NULL) return head2;
if(head2->name==tt)
{
head2=head2->next;free(p);
}
else
while(p!=NULL)
{
if(p->name==tt)
{
pold->next=p->next; free(p);
break;}
else{pold=p;p=p->next;}
}
return head2;
}
void main()
{
struct student *head3;
int menu;
char tt[10];
head3=(struct student *)malloc(sizeof(struct student));
while(1)
{
printf("Enter (1) to Add a Student to Class List\n"
" (2) to Delete a Student from Class List\n"
" (3) to show Class List\n"
" (4) to Edit marks of a Student\n"
" (5) to Quit\n");
fflush(stdout);
scanf("%d",&menu) ;
if (menu < 1 || menu > 5)
{
printf("incorrect selection");
continue;
}
else if (menu == 1)
head3=insert(head3);
else if (menu == 2)
{
printf("输入学生NAME\n");
tt=gets();
head=pdelete(head,tt);
}
else if (menu == 3)
print(head3);
else break;
}
}
高手帮忙啊!
都是head
没有head1等
#include<stdlib.h>
struct student
{
char name[10];
float score;
struct student *next;
};
struct student *insert (struct student *head)
{
struct student *p,*pnew,*pold;
pnew=(struct student *)malloc (sizeof(struct student));
scanf("%s%f",pnew->name,&pnew->score);
p=head;
if(pnew->score>head->score)
{
pnew->next=head;head=pnew;
}
else
{
while(p!=NULL&&pnew->score<p->score)
{
pold=p;p=p->next;
}
return head;
}
void print (struct student *head1)
{
struct student *p=head1;
while(p!=NULL)
{
printf("%s %.f\n",p->name,p->score);
p=p->next;
}
}
struct student *pdelete(struct student *head2,char names[10])
{
struct student *p=head2,*pold=head2;
char tt[10]=names;
if(head2==NULL) return head2;
if(head2->name==tt)
{
head2=head2->next;free(p);
}
else
while(p!=NULL)
{
if(p->name==tt)
{
pold->next=p->next; free(p);
break;}
else{pold=p;p=p->next;}
}
return head2;
}
void main()
{
struct student *head3;
int menu;
char tt[10];
head3=(struct student *)malloc(sizeof(struct student));
while(1)
{
printf("Enter (1) to Add a Student to Class List\n"
" (2) to Delete a Student from Class List\n"
" (3) to show Class List\n"
" (4) to Edit marks of a Student\n"
" (5) to Quit\n");
fflush(stdout);
scanf("%d",&menu) ;
if (menu < 1 || menu > 5)
{
printf("incorrect selection");
continue;
}
else if (menu == 1)
head3=insert(head3);
else if (menu == 2)
{
printf("输入学生NAME\n");
tt=gets();
head=pdelete(head,tt);
}
else if (menu == 3)
print(head3);
else break;
}
}
高手帮忙啊!
都是head
没有head1等
insert那个函数定义少了个结束 }
error C2601: 'main' : local function definitions are illegal
error C2601: 'Onsear' : local function definitions are illegal这两句是意思,紧急!
error C2601: 'main' : local function definitions are illegal如何解决啊?
下载don't make ma wait
i'ma连写是什么意思呢?
译:I'MA Test-Taking Star
I'ma是什么的缩写?
Parse error: parse error, unexpected '?',
Big Ma Ma
******Error******