insert(char * key, struct node *leaf, int x)
{
if (x==1) //Customer
{
if(strcmp(leaf->customer.IDNo,root->customer.IDNo)==0)
{
*leaf = (struct node) malloc(101);
*leaf->customer.IDNo = key;
/* initialize the children to null */
(*leaf)->left = 0;
(*leaf)->right = 0;
}
else if(strcmp(key,(*leaf)->customer.IDNo)<0)
{
insert(key, &(*leaf)->left);
}
else if(strcmp(key,(*leaf)->customer.IDNo)>0)
{
insert(key, &(*leaf)->right);
}
}
else //Product
{
if(strcmp(leaf->product.ProdName,root->product.ProdName)==0)
{
*leaf = (struct node) malloc(101);
(*leaf)->product.ProdName = key;
/* initialize the children to null */
(*leaf)->left = 0;
(*leaf)->right = 0;
}
else if(strcmp(key,(*leaf)->product.ProdName)<0)
{
insert(key, &(*leaf)->left);
}
else if(strcmp(key,(*leaf)->product.ProdName)>0)
{
insert(key, &(*leaf)->right);
}
}
}
45,64转换到非标量类型再审 46赋值时将指针整数,未作铸造 48,49,51,53,55,57,65,的67,68,70,72,74,76无效的类型参数 - >(有结构节点) 53,57,72,76参数太少函数“插入”试图让二叉树弦乐
Node *search(char * key, struct node *leaf,int x)
{
struct node * y;
if (x==1)
{
if(leaf != 0)
{
if(strcmp(key,leaf->customer.IDNo)==0)
{
y= leaf;
}
else if(strcmp(key,leaf->customer.IDNo)<0)
{
y= search(key, leaf->left);
}
else
{
y= search(key, leaf->right);
}
}
}
else if (x==2)
{
if(leaf != 0)
{
if(strcmp(key,leaf->product.ProdName)==0)
{
y= leaf;
}
else if(strcmp(key,leaf->product.ProdName)<0)
{
y= search(key, leaf->left);
}
else
{
y= search(key, leaf->right);
}
}
}
else y= 0;
return y;
}
94,98,112太少函数'搜索'的参数
多行发生的错误是相似的我需要的只是说明如何解决其中一个问题,剩下的事情我可以做。
请正确格式化并缩进代码。 – Swapnil
哇,这需要一些时间来格式化...... – Flagbug
当我们不知道它们对应的代码的实际行数时,行号并没有帮助。 – interjay