样例到第二行就崩,左、右儿子也判断不好,求助!
#include <cstdio>
//#include <cstring>
using namespace std;
int DaBiao[30];
struct node
{
char data;
int lchild = 0;
int rchild = 0;
}Node[30];
int main()
{
int n;
scanf("%d", &n);
for(int i = 1; i <= n; i++)
{
char l, r;
scanf("%c", &Node[i].data);
scanf("%c", &l);
scanf("%c", &r);
if(l != '*')
{
l = l - 'a' + 1;
Node[i].lchild = l;
DaBiao[l] = 1;
}
else
{
Node[i].lchild = 0;
}
if(r != '*')
{
r = r - 'a' + 1;
Node[i].rchild = r;
DaBiao[r] = 1;
}
else
{
Node[i].rchild = 0;
}
}
return 0;
}