大家看看噢,这个是怎么的错误,老是运行不对!!
#incldue<stdafx.h>#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
typedef char DataType;
struct TreeNode{
DataType data;
struct TreeNode *lchild,*rchild;
};
typedef TreeNoDE *BinTree;
BinTree CreateBinTree(){
char ch;
printf("shuruzhifu\n");
scanf("%c",&ch);
TreeNode* pNode;
if(ch=='0'){
pNode=Null;
}
else{
pNode=(TreeNode*)malloc(sizeof(TreeNode));
if(pNode==NULL){
printf("shengqingkongjianshibai");
exit(0);
}
pNode->data=ch;
pNode->lchild=CreateBinTree();
pNode->rchild=CreateBinTree();
}
return pNode;
}
void PerOrder(BinTree pRoot){/*前序*/
if(pRoot){
pirntf("%c\n",pRoot->data);
PerOrder(pRoot->lchild);
PreOrder(pRoot->rchild)
}
}
void InOrder(BinTree pRoot){/*中序*/
if(pRoot){
InOrder(pRoot->lchild);
printf("%c\n",pRoot->data);
InOrder(pRoot->rchild);
}
}
void PostOrder(BinTree pRoot){/*后序*/
if(pRoot){
PostOrder(pRoot->lchild);
PostOrder(pRoot->rchild);
printf("%c\n",pRoot->data);
}
}
void StackPreOrder(BinTree pRoot){
TreeNode* stack[200];
int top=-1;
BinTree p=pRoot;
stack[++top]=p;
while(p!=NULL || top!=-1){
if(p){
printf("%c",p->data);
stack[++top]=p->lchild;
}
else{
p=stack[top--];
p=p->rchild;
}
}
}
int main(int argc,char* argv[])
{
BinTree pRoot;
CreateBinTree(&pRoot);
printf("前序遍历:");
PreOrder(pRoot);
printf("\n");
printf("中序遍历:");
InOrder(pRoot);
printf("\n");
printf("后序遍历:");
PostOrder(pRoot);
printf("\n");
printf("\n");
return 0;
}
//fatal error C1021: invalid preprocessor command 'incldue'
执行 cl.exe 时出错.