简单的C程序错误-》关于对列的,帮改错

circleb 2005-04-15 05:37:39
#include"stdio.h"
#include"malloc.h"
struct queuenode
{ char item;
struct queuenode*former;
struct queuenode*next;
};
void enterqueue(struct queuenode*tail,*head,char ch)
{
struct queuenode*temp;
temp=(struct queuenode*)malloc(sizeof(struct queuenode));
if(tail->next==NULL)
{
tail->next=temp;
temp->former=tail;
head=temp;
temp->next=NULL;
}
else
{
temp->next=tail->next;
tail->next=temp;
temp->former=tail;
temp->next->former=temp;
}
temp->item=ch;
}
char exitqueue(struct queuenode*tail,*head)
{
struct queuenode*temp;
char ch;
if(tail->==NULL)
return(NULL);
temp=head;
head=temp->former;
head->next=NULL;
ch=temp->item;
free(temp);
return(ch);
}
main()
{
struct queuenode*tail,*head;
char ch;
tail=(struct queuenode*)malloc(sizeof(struct queuenode));
tail->former=NULL;
tail->next=NULL;
head=tail;
for( ; ; )
{
ch=getchar();
if(ch=='#')break;
enterqueue(tail,ch);
putchar(ch);
}
for( ; ; )
{
ch=exitqueue(tail,head);
if(ch==NULL)break;
putchar(ch);
}

getch();
}

win-tc中
错误: 不正确的 配置文件 选项 : ?
TC中错误
1: Unable to open include file 'STDIO.H'
2: Unable to open include file 'MALLOC.H'
8: Declaration syntax error



不明白啊!高手指点一下吧!




...全文
51 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
circleb 2005-04-15
  • 打赏
  • 举报
回复
--------------------Configuration: queu - Win32 Debug--------------------
Compiling...
queu.cpp
Linking...

queu.exe - 0 error(s), 0 warning(s)


queu.exe 遇到问题需要关闭。我们对此引起的不便表示抱歉。
请将此问题报告给 Microsoft。
不明白怎么老是遇到这种情况呢!
看来要重写了
circleb 2005-04-15
  • 打赏
  • 举报
回复


#include"iostream.h"
#include"stdio.h"
#include"malloc.h"
struct queuenode
{ char item;
struct queuenode*former;
struct queuenode*next;
};
void enterqueue(struct queuenode*tail,struct queuenode*head,char ch)
{
struct queuenode*temp;
temp=(struct queuenode*)malloc(sizeof(struct queuenode));
if(tail->next==NULL)
{
tail->next=temp;
temp->former=tail;
head=temp;
temp->next=NULL;
}
else
{
temp->next=tail->next;
tail->next=temp;
temp->former=tail;
temp->next->former=temp;
}
temp->item=ch;
}

char exitqueue(struct queuenode*tail,struct queuenode*head)
{
struct queuenode*temp;
char ch;
if(tail->next==NULL)
return(NULL);
temp=head;
head=temp->former;
head->next=NULL;
ch=temp->item;
free(temp);
return(ch);
}

void main()
{
struct queuenode*tail,*head;
char ch;
tail=(struct queuenode*)malloc(sizeof(struct queuenode));
tail->former=NULL;
tail->next=NULL;
head=tail;
for( ; ; )
{
ch=getchar();
if(ch=='#')break;
enterqueue(tail,head,ch);

}
for( ; ; )
{
ch=exitqueue(tail,head);
if(ch==NULL)break;
putchar(ch);
}


}


我用VC++6.0改了一下倒是没错误了
beggerson 2005-04-15
  • 打赏
  • 举报
回复
你不include 的路径改一下就可以啦:
在tc中是option--》directory修改你的include的路径。
他的默认值可能是c:\tc但你没放在tc 下哦。
gths123 2005-04-15
  • 打赏
  • 举报
回复
1: Unable to open include file 'STDIO.H'
2: Unable to open include file 'MALLOC.H'


路径改一下就可以了
WingForce 2005-04-15
  • 打赏
  • 举报
回复
说实在的
我从来没有用过那2个编译器。。。
zengwujun 2005-04-15
  • 打赏
  • 举报
回复
inlcude 的路径不对

69,373

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧