| 网站首页 | 业界新闻 | 群组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛

已结贴   问题点数：20  回复次数：2

#include <stdio.h>
#include <stdlib.h>

#define LEN sizeof(struct student)

struct student *creat(void);
struct student *del(struct student *head, long num);

struct student
{
long num;
float score;
struct student *next;
};

int n;

int main()
{
long del_num;
printf("input records:\n");
printf("\ninput the deleted number:");
scanf("%ld,&del_num");
return(0);
}

struct student *creat(void)
{

struct student *p1,*p2;
n = 0;
p1 = p2 = (struct student *)malloc(LEN);

scanf("%ld,%f",&p1->num,&p1->score);
while(p1->num != 0)
{

n = n + 1;
if(n == 1) head = p1;
else p2->next = p1;
p2 = p1;
p1 = (struct student *)malloc(LEN);
scanf("%ld,%f",&p1->num,&p1->score);
}

p2->next = NULL;
}

{
struct student *p;
printf("\nNow, These %d records are:\n",n);
do
{
printf("%ld \t%5.1f\n", p->num, p->score);
p = p->next;
} while(p != NULL);
}

struct student *del(struct student *head, long num)
{
struct student *p1,*p2;
{printf("\nlist null!\n");
}
while(num!=p1->num && p1->next!=NULL)
{p2=p1;p1=p1->next;}
if(num == p1->num)
else p2->next = p1->next;
printf("delete:%ld\n",num);
n=n-1;
}
else printf("%ld not been found!\n", num);
}

得分:20

int main()
{
long del_num;
printf("input records:\n");
printf("\ninput the deleted number:");
scanf("%ld",&del_num);//*********************************************,&del_num被放进了引号
return(0);
}
得分:0

• 3
• 1/1页
• 1