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