|
#include<stdio.h>
#include<string.h>
#include<stdib.h>
#define LEN sizeof(struct AddressList)
struct AddressList
{
char name[20];
char telephone[12];
char e_mail[30];
struct AddressList *next;
};
atruct AddressList * create(void);
main()
{
struct AddressList *h;
h = create();
}
struct AddressList * create()
{
struct AddressList *head;
struct AddressList *p;
struct AddressList *tail;
char name[20];
head = NULL;
tail = NULL;
printf("请输入结点数据:\n");
printf("姓名:");
gets(name);
while(strcmp(name,"")!=0)
{
p=(struct AddressList *)malloc(LEN);
if(p==NULL)
{
printf("内存不足!\n");
exit(1);
}
else
{
strcpy(p-name,name);
printf("电话:");
gets(p->telephone);
printf("Email地址:");
gets(p->e_mail);
if(head==NULL)
head=p;
else
tail->next=p;
tail=p;
printf("\n请输入下一个结点数据:\n");
printf("姓名:");
gets(name);
}
}
if (head !=NULL)
tail->next=NULL;
printf("建立链表过程结束\n");
return head;
}
--------------------Configuration: 2题 - Win32 Debug--------------------
Compiling...
2题.cpp
F:\2题.cpp(3) : fatal error C1083: Cannot open include file: 'stdib.h': No such file or directory
执行 cl.exe 时出错.
2题.obj - 1 error(s), 0 warning(s)
|
|