• 大小: 2KB
    文件类型: .cpp
    金币: 1
    下载: 0 次
    发布日期: 2021-05-07
  • 语言: C/C++
  • 标签:

资源简介

1、输入学生信息,建立链表; 2、输出链表中全部学生信息; 3、根据姓名检索学生信息; 4、打印成绩不及格学生名单。

资源截图

代码片段和文件信息

#include
#include
#include
#include

typedef struct stu_snode
{
int num;
char name[15];
float score;
struct stu_snode *next;
}STUDENT;

void input_data(STUDENT *p)
{
float a;
printf(“\ninput num:“);
scanf(“%d“&p->num);
printf(“input name:“);
scanf(“%s“&p->name);
printf(“input score:“);
scanf(“%f“&p->score);
p->score=a;
}

STUDENT *create_list()
{
char c;
STUDENT *head*tail*p;
head=tail=NULL;
while(1)
{
printf(“Enter(Y/N)“);
c=getch();
if(c==‘y‘||c==‘Y‘)
{
p=(STUDENT*)malloc(sizeof(STUDENT));
input_data(p);
p->next=NULL;
if(head==NULL)
head=tail=p;
else
{
tail->next=p;
tail=p;
}
}
else
break;
}
return head;
}

void print_list(STUDENT *head)
{
STUDENT 

评论

共有 条评论

相关资源