| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
Reworld,下班在家制作游戏,1500万奖金等你拿以码会友 以友辅仁
共有 460 人关注过本帖
标题:求解 线性表编译出错
只看楼主 加入收藏
东风恶
Rank: 1
等 级:新手上路
帖 子:14
专家分:8
注 册:2013-4-20
结帖率:100%
  问题点数:0  回复次数:0   
求解 线性表编译出错

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

#define MaxCol 10            

void CreateTable(HList *&h);           
void DestroyTable(HList *h);
void DispTable(HList *h);
void LinkTable(HList *h1,HList *h2,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);
    LinkTable(h1,h2,h);           
    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;                     
    }
}



void LinkTable(HList *h1,HList *h2,HLIst *&h)
{
    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;
}
搜索更多相关主题的帖子: include 线性表 
2013-09-23 21:15
快速回复:求解 线性表编译出错
数据加载中...
 
   





关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.052654 second(s), 8 queries.
Copyright©2004-2019, BCCN.NET, All Rights Reserved