| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 Reworld，下班在家制作游戏，1500万奖金等你拿 以码会友 以友辅仁

问题点数：0  回复次数：0

#include <stdio.h>
#include <stdlib.h>

#define MaxCol 10

void CreateTable(HList *&h);
void DestroyTable(HList *h);
void DispTable(HList *h);

typedef struct Nodel
{
ElemType data[MaxCol];
struct Nodel *next;
}DList;
typedef struct Node2
{
int Row,Col;
DList *next;
}HList;
typedef int ElemType;

void main()
{
HList *h1, *h2, *h;
printf("±í1:\n");
CreateTable(h1);
printf("±í2:\n");
CreateTable(h2);
printf("&Aacute;&not;&frac12;&Oacute;&frac12;á&sup1;&ucirc;±í&pound;&ordm;\n");
DispTable(h);
DestroyTable(h1);
DestroyTable(h2);
DestroyTable(h);
}

void CreateTable(HList *&h)
{
int i,j;
DList *r, *s;
h = (HList *)malloc(sizeof(HList));
printf("±í&micro;&Auml;&ETH;&ETH;&Ecirc;&yacute;&pound;&not;&Aacute;&ETH;&Ecirc;&yacute;&pound;&ordm;");
scanf("%d,%d",&h->Row,&h->Col);
for(i=0;i<h->Row;i++)
{
printf("&micro;&Uacute;%d&ETH;&ETH;&pound;&ordm;",i+1);
s = (DList *)malloc(sizeof(DList));
for(j=0;j<h->Col;j++)
scanf("%d,",&s->data[j]);
if (h->next == NULL)
h->next = s;
else
r->next = s;

r=s;
}
r->next = NULL;
}

void DestroyTable(HList *h)
{
DList *pre = h->next, *p = pre->next;
while(p!=NULL)
{
free(pre);
pre = p;
p = p->next;
}
free(pre);
free(h);
}

void DispTable(HList *h)
{
int j;
DList *p = h->next;
while(p!=NULL)
{
for(j=0;j<h-.Col;j++)
printf("%4d",p->data[j]);
printf("\n");
p = p->next;
}
}

{
int i,j,k;
DList *p = h->next,*q, *s, *r;
printf("&Aacute;&not;&frac12;&Oacute;×&Ouml;&para;&Icirc;&Ecirc;&Ccedil;&pound;&ordm;&micro;&Uacute;1&cedil;&ouml;±í&ETH;ò&ordm;&Aring;&pound;&not;&micro;&Uacute;2&cedil;&ouml;±í&ETH;ò&ordm;&Aring;&pound;&ordm;");
scanf("%d,%d",&i,&j);
h = (HList *)malloc(sizeof(HList));
h->Row = 0;
h->Col = h1->col+h2->Col;
h->next = NULL;
while(p!=NULL)
{
q=h2->next;
while(q!=NULL)
{
if(p->data[i-1] == q->data[j-1])
{
s = (DList *)malloc(sizeof(DList));
for(k=0;k<h1->Col;k++)
s->data[k] =p->data[k];
for(k=0;k<h2->Col;k++)
s->data[h1->Col+k] = q->data[k];
if (h->next == NULL)
h->next = s;
else
r->next = s;

r=s;
h->Row++;
}
q = q->next;
}
p = p->next;
}
r->next = NULL;
}

• 1
• 1/1页
• 1