Advertisement
Guest User

Untitled

a guest
Feb 12th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. DNA* DNAList::find(int id) {
  2.  
  3. /*if (head->next != nullptr) {
  4. cur = head->next;
  5. }
  6. else {
  7. return nullptr;
  8. }*/
  9. bool found = false;
  10. cur = head;
  11.  
  12. while (!found && cur->next != nullptr) {
  13. if (cur->dna->dnaOne.id == id ) {
  14. found = true;
  15. }
  16. else {
  17. cur = cur->next;
  18. }
  19. }
  20.  
  21. if (found) {
  22. return cur->dna;
  23. }
  24. else {
  25. return nullptr;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement