function does not take 1 parameters
#include<stdio.h>#include<stdlib.h>structstudent{charname[10];floatscore;structstuden...
#include<stdio.h>
#include<stdlib.h>
struct student
{
char name[10];
float score;
struct student *next;
};
void main()
{
struct student *create();
struct student *pdelete();
void print();
struct student *head;
int n;
printf("Input the number of nodes:\n");
scanf("%d",&n);
head=create(n);
printf("Output all nodes:\n");
print(head);
head=pdelete(head,60);
printf("Output fail-nodes:\n");
print(head);
}
struct student *create(int n)
{
struct student *head,*pnew,*ptail;
int i;
pnew=(struct student*)malloc(sizeof(struct student));
scanf("%s%f",pnew->name,&pnew->score);
head=ptail=pnew;
for(i=1;i<n;i++)
{
pnew=(struct student*)malloc(sizeof(struct student));
scanf("%s%f",pnew->name,&pnew->score);
ptail->next=pnew;
ptail=pnew;
}
ptail->next=NULL;
return head;
}
struct student *pdelete(struct student *head,int grade)
{
struct student *p,*pold;//删除满足指定条件的链表头部的连续若干节点
p=head;
while(head!=NULL&&head->score>=grade)
{
head=head->next;
free(p);
p=head;
}
if(head==NULL) return head;
p=head->next;
pold=head;
while(p!=NULL)
{
if(p->score>=grade)
{
pold->next=p->next;
free(p);
p=pold->next;
}
else{
pold=p;
p=p->next;
}
}
return head;
}
void print(struct student *head)
{
struct student *p=head;
while(p!=NULL)
{
printf("%s %.1f\n",p->name,p->score);
p=p->next;
}
}Cpp1.cpp(18) (20)(21)(23)function does not take 2 parameters 展开
#include<stdlib.h>
struct student
{
char name[10];
float score;
struct student *next;
};
void main()
{
struct student *create();
struct student *pdelete();
void print();
struct student *head;
int n;
printf("Input the number of nodes:\n");
scanf("%d",&n);
head=create(n);
printf("Output all nodes:\n");
print(head);
head=pdelete(head,60);
printf("Output fail-nodes:\n");
print(head);
}
struct student *create(int n)
{
struct student *head,*pnew,*ptail;
int i;
pnew=(struct student*)malloc(sizeof(struct student));
scanf("%s%f",pnew->name,&pnew->score);
head=ptail=pnew;
for(i=1;i<n;i++)
{
pnew=(struct student*)malloc(sizeof(struct student));
scanf("%s%f",pnew->name,&pnew->score);
ptail->next=pnew;
ptail=pnew;
}
ptail->next=NULL;
return head;
}
struct student *pdelete(struct student *head,int grade)
{
struct student *p,*pold;//删除满足指定条件的链表头部的连续若干节点
p=head;
while(head!=NULL&&head->score>=grade)
{
head=head->next;
free(p);
p=head;
}
if(head==NULL) return head;
p=head->next;
pold=head;
while(p!=NULL)
{
if(p->score>=grade)
{
pold->next=p->next;
free(p);
p=pold->next;
}
else{
pold=p;
p=p->next;
}
}
return head;
}
void print(struct student *head)
{
struct student *p=head;
while(p!=NULL)
{
printf("%s %.1f\n",p->name,p->score);
p=p->next;
}
}Cpp1.cpp(18) (20)(21)(23)function does not take 2 parameters 展开
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
展开全部
你的函数声明里 没有写参数,函数实现里有参数,不对应
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你上面声明了void exit();是想自定义这个函数?声明的时候没有参数为什么调用的时候还带一个参数exit(0),如果你是想用库函数就不要声明这个函数了,直接include stdlib.h 就好了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询