- 43
- 0
- 约3.37千字
- 约 13页
- 2017-09-13 发布于湖北
- 举报
第二题:建立一个线性链表,其元素值为:包括学号、姓名、性别、年龄等信息。并依次从键盘输入(输入时要有相应的提示)以输入0结束,然后依次输出线性链表中的各元素值。
#include stdlib.h
#include stdio.h
#define null 0
#define size 40
struct node
{
char num[6];
char name[8];
char sex[2];
int age;
struct node * next;
};
void main ()
{
int x;
struct node * head;
struct node * p,* q;
head=(struct node *)malloc(size);
p=head;
printf(if exit:pleas into 0 );
scanf(%d,x);
while (x!=0)
{
q=(struct node *)malloc(size);
printf(num\n);
scanf(%s,q-num);
printf(name\n);
scanf(%s,q-name);
printf(sex\n);
scanf(%s,q-sex);
printf(age\n);
scanf(%d,q-age);
p-next=q;
p=q
您可能关注的文档
- 常用 国际贸易术语讲解.ppt
- 常用字3500组词.doc
- 带传动链传动(精品 值得参考).ppt
- 常用合金铸件的生产4.ppt
- 常用急救包的使用.ppt
- 常用机床组、系代号及主参数(截).ppt
- 常用现场急救技术.ppt
- 常用仪表的介绍.ppt
- 常用计算的基本理论和方法(下).ppt
- 常用的货车品牌.ppt
- 2026年冀教版(三起)(新教材)小学英语四年级下册期末综合测试卷及答案(2套).pdf
- 2026年统编版小学语文二年级下册期末字词专项复习卷含答案.pdf
- 2026年外研版(三起)版小学英语六年级下册期末综合测试卷及答案.docx
- 2026年人教PEP版(一起)(新教材)小学英语一年级下册期末综合测试卷及答案(2套).pdf
- 2026年北京版小学数学六年级下册期末综合测试卷及答案.docx
- 2026年冀教版(三起)小学英语五年级下册期末质量检测卷及答案.pdf
- 2026年北师大版小学小升初数学模拟检测卷附答案.pdf
- 2026年人教新起点版小学英语六年级下册期末综合测试卷及答案(2套).pdf
- 2026年青岛版小学数学五年级下册期末综合测试卷及答案.docx
- 2026年人教新起点版小学英语五年级下册期末学情自测卷及答案.docx
原创力文档

文档评论(0)