一个出关于链表的问题

来源:百度知道 编辑:UC知道 时间:2024/05/13 04:07:55
不知道为和不运行output函数中的输出函数的东西,程序段为:
#include<stdio.h>
#include<stdlib.h>
typedef struct as
{
int num;
char name[10];
int grade[3];
struct as *next;
struct as *l_nane;
}as;
main()
{
void input(as*);
void output(as*);
int i;
as *head;
head=(as*)malloc(sizeof(as));
head->next=NULL;
head->l_nane=NULL;
printf("\t\t\t* 1.新建学生数据 *\n");
printf("\t\t\t* 2.输出学生数据 *\n");
printf("请输入相应的操作序号:");
do
{
scanf("%d",&i);
switch(i)
{
case 1:
input(head);
break;
case 2:
output(head);
break;
default:
printf("输入错误序号!\n请重新输入:");
}
}
while(i>3);
}
void input(as *e)
{
int i,c;
as *a,*b;
a=e;
printf("请输入添加的个数:&qu

增加
循环信息
增加退出功能
while(T)

//**增加的***************************/
main()
{
void input(as*);
void output(as*);
int i;
as *head;
head=(as*)malloc(sizeof(as));
head->next=NULL;
head->l_nane=NULL;
bool T=true;//**增加的
while(T)//**增加的
{//**增加的
printf("\t\t\t* 1.新建学生数据 *\n");
printf("\t\t\t* 2.输出学生数据 *\n");
printf("\t\t\t* 3.退出 *\n");//**增加的
printf("请输入相应的操作序号:");
do{
scanf("%d",&i);
switch(i)
{
case 1:
input(head);
break;
case 2:
output(head);
break;
case 3: //**增加的
T=false; //**增加的
break; //**增加的
default:
printf("输入错误序号!\n请重新输入:");
}
} while(i>3);
}
}//**增加的