-
大小: 2KB文件類(lèi)型: .cpp金幣: 1下載: 0 次發(fā)布日期: 2021-05-07
- 語(yǔ)言: C/C++
- 標(biāo)簽:
資源簡(jiǎn)介
1、輸入學(xué)生信息,建立鏈表;
2、輸出鏈表中全部學(xué)生信息;
3、根據(jù)姓名檢索學(xué)生信息;
4、打印成績(jī)不及格學(xué)生名單。
代碼片段和文件信息
#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?
評(píng)論
共有 條評(píng)論