template<class T>
bool ListType<T>::find(const T&) const{
NodeType<T>* temp = this->head;
bool found = false;
while ((temp != nullptr) && (!found)) {
if (temp->next = this->head)
found = true;
else
temp = temp->next;
}
return found;
}
Ulist Functions
UList1: 24464, 26962, 29358, 11478, 15724, 19169, 26500, 6334, 18467, 41 Find: 0
cout << "Find: " << ulist2.find(6334) << endl;
OList Functions
OList1: 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 Find: 1
cout << "Find: " << olist2.find(5) << endl;
The function calls are what follows the output of
Aucun commentaire:
Enregistrer un commentaire