c语言单链表应用

来源:百度知道 编辑:UC知道 时间:2024/09/22 07:10:40
#include <stdio.h>
#include <string.h>

typedef int datatype;
#define MAXSIZE 20
typedef struct Book
{
char Name[MAXSIZE];
char ISBN[MAXSIZE];
char Price[MAXSIZE];
char Write[MAXSIZE];
char Chu[MAXSIZE];
char Id[MAXSIZE];
struct Book *next;
}LinkList;
LinkList *init()
{
LinkList *L;
L=(LinkList *)malloc(sizeof(LinkList));
if(L)
{ L->next=NULL;
printf("lian biao chu shi hua cheng gong.\n");
return L;
}
else
return(0);

}
input(LinkList *L)
{

LinkList *s=(LinkList *)malloc(sizeof(LinkList));
printf("nanme:");
gets(s->Name);
fflush(stdin);
printf("ISBN:");
gets(s->ISBN);
fflush(stdin);
printf("price:");
gets(s->Price);

改好了在VC++6.0下通过具体改哪了你自己找吧.
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
typedef int datatype;
#define MAXSIZE 20
typedef struct Book
{
char Name[MAXSIZE];
char ISBN[MAXSIZE];
char Price[MAXSIZE];
char Write[MAXSIZE];
char Chu[MAXSIZE];
char Id[MAXSIZE];
struct Book *next;
}LinkList;
LinkList *init()
{
LinkList *L;
L=(LinkList *)malloc(sizeof(LinkList));
if(L)
{ L->next=NULL;
printf("lian biao chu shi hua cheng gong.\n");
return L;
}
else
return(NULL);

}
void input(LinkList *L)
{

LinkList *s=(LinkList *)malloc(sizeof(LinkList));
printf("nanme:");
gets(s->Name);
fflush(stdin);
printf("ISBN:");
gets(s->ISBN);
fflush(stdin);
pr