私はユーザー入力を取得しており、whileループを使用して入力の検証を続けています。 しかし、入力する入力の種類が真であるとは限りませんが、偽を返してループを繰り返し続けます。 BSTクラスのwhileループが繰り返されない場合
String deletelName;
System.out.println("Type patient's last name to delete");
deletelName = cin.next();
Patient removePatient = new Patient (deletelName.toLowerCase(),null,null,null,null);
while (!bst.contains(removePatient)) {
System.out.println("Patient's last name does not exist. Type another last name : ");
deletelName = cin.next();
}
パート:
public boolean contains(AnyType x)
{
return contains(x, root);
}
private boolean contains(AnyType x, BinaryNode<AnyType> t)
{
if (t == null)
return false;
int compareResult = x.compareTo(t.element);
if(compareResult < 0)
return contains(x, t.left);
else if (compareResult > 0)
return contains (x, t.right);
else
return true;
}
'bst'は何ですか?A:このようなもので
:ソリューションは、これを交換することですかこれ以上のコードを提供する必要があります。 – Gendarme
あなたはそれを仲間で解決しましたか?あなたがした場合は、答えを受け入れてスレッドを閉じます。 – Vucko