一个算法不明白
#include<stdio.h>#include<conio.h>
#include<alloc.h>
typedef int dataType;
typedef struct node
{dataType data;
struct node *next;
}*LinkList;
void init_linklist(LinkList head);
void release_linklist(LinkList head);
void clear_linklist(LinkList head);
void creatlist(LinkList head);
void out(LinkList head);
void select(LinkList head);
void exitJosephus();
void init_linklist(LinkList head);
{head=malloc(sizeof(struct node);
head->data=-1;
head->next=head;
}
void clear_linklist(LinkList head)
{LinkList p,q;
p=head->next;
head->next=head;
while(p!=head)
{q=p;
p=p->next;
free(q);
}
}
void creatlist(LinkList head)
{int num;
LinkList p;
clear_linklist(head);
printf("\n\nInput integer(ending with -1:\n");
scanf("%d",&num);
while(num!=-1)
{p=malloc(sizeof(struct node));
p->data=num;
p->next=head->next;
head->next=p;
scanf("%d",&num);
}
}
void out(LinkList head)
{int i,n;
LinkList p;
i=1;
n=1;
p=head->next;
printf("\n\n");
while(p!=head)
{if(n==6)
{n=1;
printf("\n");
}
printf("%5d:%-5d|",i,p->data);
i++;
n++;
p=p->next;
}
}
void select(LinkList head)
{int m,k=0;
LinkList p,pre,u;
p=head;
printf("\n\nCout Number m==?");
scanf("%d",&m);
printf("\n\n\n\n%40s\n\n","select");
while(p->next!=p)
{pre=p;
p=p->next;
if(p==head)
{pre=p;
p=p->next;
}
++k;
if(k==m)
{printf("%d",p->data);
pre->next=p->next;
u=p;
free(u);
p=pre;
k=0;
}
}
printf("\n\n%40s","select out!");
}
void release_linklist(LinkList head)
{clear_linklist(head);
free(head);
}
void exitJosephus()
{printf("Good Bye!\n");
}
void main()
{int choice;
LinkList head;
init_linklist(head);
do
{printf("%S%15S%15S%15S%15S%","\n\n\n\n\n\n","1:Create","2:Out","3:Select","4:ExitJosephus");
printf("\n\n%33c",'');
scanf("%d",&choice);
switch(choice)
{case'1':creatlist(head);
out(head);
break;
case'2':out(head);
break:
case'3':select(head);
break;
case'4':exitJosephus();
break;
default:printf("\nWrong select!Try again!");
}
}
while(choice!='4');
release_linklist(head);
}
提示错误信息:F:\习题\hxl\1.cpp(3) : fatal error C1083: Cannot open include file: 'alloc.h': No such file or directory
郁闷,大家都帮忙看看