用C++写的一个创建顺序表,并且初始化一个顺序表的程序,为什么编译不通过?求大神帮忙看看有关问题出哪了
用C++写的一个创建顺序表,并且初始化一个顺序表的程序,为什么编译不通过?求大神帮忙看看问题出哪了.
#include <iostream>
using namespace std;
#define TURE 1
#define FALSE 0
#define ERROR 0
#define OK 1
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;
#define LIST_INTT_SIZE 100
#define LISTINCREMENT 10
typedef struct {
char * elem;
int length;
int listsize;
}SqList;
Status Initlist_Sq(Sqlist &L)
{
L.elem=(char *)malloc(LIST_INIT_SIZE*sizeof(char));
if(!L.elem)exit(OVERFLOW);
L.length =0;
L.listsize=LIST_INIT_SIZE;
return OK;
}
int main ()
{
SqList L1;
Initlist_Sq(L1);
return 0;
}
------解决方案--------------------
(Sqlist &L) // 大小写。。。
LIST_INIT_SIZE // #define LIST_INTT_SIZE 100 名字又错了
#include <cstdlib> // 缺少头文件
return OK; } // 这一块代码中可能还有全角下的字符
楼主太不细心了,不应该
------解决方案--------------------
#include <iostream>
using namespace std;
#define TURE 1
#define FALSE 0
#define ERROR 0
#define OK 1
#define INFEASIBLE -1
#define OVERFLOW -2
typedef int Status;
#define LIST_INTT_SIZE 100
#define LISTINCREMENT 10
typedef struct {
char * elem;
int length;
int listsize;
}SqList;
Status Initlist_Sq(Sqlist &L)
{
L.elem=(char *)malloc(LIST_INIT_SIZE*sizeof(char));
if(!L.elem)exit(OVERFLOW);
L.length =0;
L.listsize=LIST_INIT_SIZE;
return OK;
}
int main ()
{
SqList L1;
Initlist_Sq(L1);
return 0;
}
------解决方案--------------------
(Sqlist &L) // 大小写。。。
LIST_INIT_SIZE // #define LIST_INTT_SIZE 100 名字又错了
#include <cstdlib> // 缺少头文件
return OK; } // 这一块代码中可能还有全角下的字符
楼主太不细心了,不应该
------解决方案--------------------
#include <iostream>
using namespace std;
#define TURE 1