#include<stdio.h>
#include<stdlib.h>
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef int ElemType
#define OK 0
#define OVERFLOW 0
typedef struct {
ElemType * lem;
int listsize;
}SqList;
int InitList(SqlList &L)
{
L.elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L.elem) exit(OVERFLOW);
L.listsize=LIST_INIT_SIZE;
for(int=0;i<L.listsize;i++)
{
L.elem[i]=i;
}
return OK;
}
int PaiXu(SqlList &L)
{
int i,k,j;
for(i=0;i<50;i++)
{
if(L.elem[i]%2==0)
{
for(k=100;k<51;k--)
{
if(L.elem[k]%2==1)
{
j=L.elem[i];
L.elem[i]=L.elem[j];
L.elem[j]=j;
}
}
}
}
return Ok;
}
void DisList(SqlList &L)
{
while(L.elem[i])
{
printf("%n",L.elem[i]);
i++;
}
}
void main()
{
SqlList L;
InitList(L);
PaixuXu(L);
DisList(L);
}
还是不对啊,老是报这俩错。
1.cpp(9) : error C2143: syntax error : missing ';' before ''
1.cpp(9) : fatal error C1004: unexpected end of file found