7-1 两个有序链表序列的合并(20 分)#include<iostream>
#include<malloc.h>
#define OK 1
#define ERROR 0
#define OVERFLOW -1
using namespace std;
typedef int Status;
typedef int ElemType;
typedef struct LNode
{
ElemType data;
struct LNode* next;
} LNode, *LinkList;
Status InitList(LinkList& L)
{
L = new LNode;
if(!L)
exit(OVERFLOW);
L->next = NULL;
return OK;
}
Status InsertList(LinkList& L)
{
LNode* p = L;
int num;
while(1)
{
cin >> num;
if(num == -1)
{
break;
}
else
{
LNode* r;
r = new LNode;
r->data = num;
r->next = p->next;
p->next = r;
p = r;
}
}
return OK;
}
void PrintList(LinkList& L)
{
LNode* p = L->next;
if(!p)
cout <<
#include<iostream>
#include<malloc.h>
#define OK 1
#define ERROR 0
#define OVERFLOW -1
using namespace std;
typedef int Status;
typedef int ElemType;
typedef struct LNode
{
ElemType data;
struct LNode* next;
} LNode, *LinkList;
Status InitList(LinkList& L)
{
L = new LNode;
if(!L)
exit(OVERFLOW);
L->next = NULL;
return OK;
}
Status InsertList(LinkList& L)
{
LNode* p = L;
int num;
while(1)
{
cin >> num;
if(num == -1)
{
break;
}
else
{
LNode* r;
r = new LNode;
r->data = num;
r->next = p->next;
p->next = r;
p = r;
}
}
return OK;
}
void PrintList(LinkList& L)
{
LNode* p = L->next;
if(!p)
cout <<