12.07.2015 Views

C++ - VideoTutorials-bg.com

C++ - VideoTutorials-bg.com

C++ - VideoTutorials-bg.com

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

#include "L-List.cpp"typedef LList IntList;bool member(int x, IntList l){l.IterStart();elem *p = l.Iter();if (!p) return false;int y;l.DeleteElem(p, y);return x == y || member(x, l);}// а)void unilists(IntList p, IntList q, IntList &r){p.IterStart();q.IterStart();elem *pp = p.Iter(),*qq = q.Iter();while (pp){if (!member(pp->inf, r)) r.ToEnd(pp->inf);pp = pp->link;}while (qq){if (!member(qq->inf, r)) r.ToEnd(qq->inf);qq = qq->link;}}// б)void intersections(IntList p, IntList q, IntList &r){p.IterStart();q.IterStart();elem *pp = p.Iter(),*qq = q.Iter();while (pp){if (!member(pp->inf, r) && member(pp->inf, q))r.ToEnd(pp->inf);pp = pp->link;}155

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!