?? 4.cpp
字號:
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#define null 0
typedef struct node
{ char data;
node *lchild;
node *rchild;
}* bitree;
int setup(bitree &t)
{char ch=' ';
scanf("%c",&ch);
if(ch==' ')t=null;
else{
if(!(t=(node *)malloc(sizeof(node))))return 0;
t->data=ch; //建立根節點
printf("%c",t->data);
setup(t->lchild);//建立左子樹
setup(t->rchild);//建立右子樹
}
return 1;
}
void main()
{bitree t=null;
printf("輸入數值:");
setup(t);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -