标题:win tc 编译问题,说明语法错误在Reverse中....我看不明白
取消只看楼主
zyyk415
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2007-5-7
 问题点数:0 回复次数:0 
win tc 编译问题,说明语法错误在Reverse中....我看不明白

我用win tc 时编译时说:说明语法错误在Reverse中..请大家指点一下!thanks






#include "stdio.h"
#include "math.h"


struct NODE_TYPE
{
int Data;
struct NODE_TYPE *pNext;
};
struct LIST_TYPE
{
struct NODE_TYPE *pHead;
int Length,n,list[];
};


#include "lab3h.h"

main()
{
void Reverse();

/*下面填写主程序*/
void Initiate();
int Length();
int *GetAt();
int GetIndex();
int Insert();
int Delete();

void Reverse();

struct LIST_TYPE list;
struct NODE_TYPE id,data1,data2 ;
int i,j,lg,x,data;
/* ①创建一个空表[Initiate( )]; */
printf("Initiate List!\n");
Initiate(&list);

/* ②提示用户输入"线性表长度"; */
printf("The Length of List is:");
scanf("%d",&lg);

/* ③根据用户输入的"线性表长度",逐一提示用户输入"线性表中的各个元素",完成线性表的构造[Insert()]; */
for(i=1;i<=lg;i++)
{
printf("Enter the %dth data:",i);
scanf("%d",&x);
Insert(&list,i,x);
}

/* ④通过调用子程序Length() 打印输出当前线性表的长度; */
lg=Length(&list);
printf("The length of List is :\t%d!\n",lg);

/* ⑤自行编写子程序PrintList( ) 打印输出当前线性表的所有元素;*/

printf("The List is:\n");


PrintList(&list,x);


/* ⑥提示用户输入要查找的元素数值,通过调用子程序*Find( ) 找到符合要求的第一个元素,并打印输出该元素的数值; */
/* *GetPrior( ) 打印输出该元素的前驱元素值; */
/* *GetNext( ) 打印输出该元素的后继元素值;
*/
printf("Enter the data to be searched:");
scanf("%d",&data);

id=*Find(&list,data);
printf("found of data %d is :\t %d \n",data,id.Data);

data1=*GetPrior(&list,data);
printf("Prior of data %d is :\t %d \n",data,data1);

data2=*GetNext(&list,data);
printf("Next of data %d is :\t %d \n",data,data2);

/* ⑦通过调用子程序Insert( ) 在当前线性表的表头和表尾各插入一个元素0 ,打印输出插入后的线性表[PrintList( )];*/

printf("Insert data 0 into Head and End of List!\n");
Insert(&list,1,0);
Insert(&list,lg+2,0);
printf("The List after insert operation is:\n");

PrintList(&list);

/* ⑧通过调用子程序Delete( ) 删除⑦中插入的各个元素,打印输出删除后的线性表[PrintList( )]; */
printf("Delete the data Inserted!\n");
Delete(&list,1);
Delete(&list,lg+1);
printf("The List after Insert operation is:\n");

PrintList(&list);


/* ⑨调用自行编写的链式结构下线性表的逆转子程序Reverse( ),打印输出逆转后的线性表[PrintList( )]。*/
printf("the list is:\n");
Reverse(list) ;
printf("the operate:\n");
printflist(&list);


getch();
}


void Reverse(list)

struct LIST_TYPE *list

{
int Length();

struct NODE_TYPE *pNode,*pNode1

if(Length(list)>=2)

{pNode=list->pHead;

for (i=1:i<=floor(Lengh(list)/2);i++)

{pNode1=pNode;

for(j=1;j<=(lengh(list)-2*i+1);i++)

{pNode1=pNode->pnext;

pNode->Data=pNode->Data^pNode1->Data ;

pNode1->Data=pNode1->Data^pNode->Data ;

pNode->Data=pNode->Data^pNode1->Data ;}


pNode=pNode->pNext ;

}

}
}

搜索更多相关主题的帖子: Reverse win 语法 编译 
2007-05-09 08:18



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-137807-1-1.html




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

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