文章

82

粉丝

343

获赞

27

访问

662.4k

头像
runtime error问题是为什么
P1161 清华大学/南京大学2018机试题
发布于2021年2月1日 12:43
阅读数 8.5k

#include <iostream>
#include <string.h> 
using namespace std;

typedef struct node{
    char data;
    struct node *lchild;
    struct node *rchild;
}BiNode,*BiTree;

char s[201];
int ind=0;
void build(BiTree &T){
    if(ind>=strlen(s)) return ;//不然报runtime error 
    char c=s[ind++];
    if(c=='#'){
        T=NULL;
        return ;
    }    
    else{
        T=new BiNode;
        T->data=c;
        build(T->lchild);
        build(T->rchild);
    }
}

void mid_order(BiTree T){
    if(T==NULL) return ;
    mid_order(T->lchild);
    cout&...

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发