帮忙翻译下面一段程序1(周一前完成)多谢

来源:百度知道 编辑:UC知道 时间:2024/05/19 03:25:56
由于程序比较长 分两段来做 希望高手快点帮忙 有200积分!
#include<stdio.h>
#include<malloc.h>
#include<conio.h>
#define ERROR 0
#define OK 1
#define EQUAL 1
#define OVERFLOW -1
#define LIST_INIT_SIZE 100
#define LISTINCREMENT 10
typedef char ElemType;
typedef struct
{
ElemType *elem;
int length;
int listsize;
}sqlist;
int init(sqlist *L)
{
L->elem=(ElemType *)malloc(LIST_INIT_SIZE*sizeof(ElemType));
if(!L->elem) exit(OVERFLOW);
L->length=0;
L->listsize=LIST_INIT_SIZE;
return OK;
}
int ListLength(sqlist *L)
{
return L->length;
}
void GetElem(sqlist L,int i,ElemType *e)
{
*e=L.elem[i];
}
int EqualList(ElemType *e1,ElemType *e2)
{
if (e1==e2)

#包括<stdio.h>
#包括<malloc.h>
#包括<conio.h>
#定义错误0
# 1款规定确定
#定义等一日
#定义溢出-1
#定义LIST_INIT_SIZE 100
#定义LISTINCREMENT 10个
typedef焦炭ElemType ;
typedef结构

ElemType *元件;
整数长度;
整数listsize ;
) sqlist ;
整数的init ( sqlist *长)

L型“元件= ( ElemType * )内存分配( LIST_INIT_SIZE *大小( ElemType ) ) ;
如果( ! L型“元件)退出(溢出) ;
L型“长度= 0 ;
L型“ listsize = LIST_INIT_SIZE ;
返回行;

整数ListLength ( sqlist *长)

返回L型“长度;

无效GetElem ( sqlist L时,整数一, ElemType *电子)

*您的E = L.elem [一] ;

整数EqualList ( ElemType *素E1 , ElemType *素E2 )

如果(素E1 ==素E2 )
返回1 ;
其他
返回0 ;

整数Less_EqualList ( ElemType *素E1 , ElemType *素E2 )

如果(素E1 “素E2 )
返回1 ;
其他
返回0 ;

整数LocateElem ( sqlist *香格里拉大酒店ElemType娥int类型)

整数一;
开关(类型)