1、家电库存管理系统(Home appliance inventory management system)#包含 iostream 。H#包括下一个=空;n,i;字符 c;create_l(头) ;做菜单(2) ;cout n;开关(n)案例 1:add_l(头) ;打破;案例 2:delete_l(头) ;打破;案例 3:search_l(头) ;打破;案例 4:系统(“CLS” ) ;p =头-下一个;我= 1;而(P!= null)cout c;if (c = = y | | c = = y)delete all _ (head);court kindnext = NULL;P-next
2、= newNode;P = p-next;Fin.close ();Bool check (LinkList P1, LinkList P2) / / size of the brand and type of comparison between P1 and P2, ready for sortingIf (p1-kind p2-kind)Return true;If (? StrCmp (p1-brand, p2-brand)Return true;Return false;Void add_L (LinkList LinkList newNode = new Node;CoutnewN
3、ode-kind;While (newNode-kindkind5 |)CoutnewNode-kind;If (newNode-kind5 newNode-kindnewNode-model;CoutnewNode-brand;CoutnewNode-weight;CoutnewNode-value;CoutnewNode-amount;CoutnewNode-date;CoutnewNode-factory;NewNode-next = NULL;LinkList pre, cur;Pre = head;Cur = head-next;If (head-next = NULL)Head-n
4、ext = newNode;ElseWhile (cur! =NULL Cur = cur-next;NewNode-next = cur;Pre-next = newNode;Coutnext;While (P = = NULL)Fout.write (char*) P, sizeof (Node);P = p-next;Fout.close ();Void output (Node *p) / / output functionCoutkindmodelweight, brandamountdatevaluefactory n;while (n 5)court n;p = checkdat
5、a (head, n );if (pre = = null)return;char c;court c;if (c = = y | | c = = y)pre - next = p - next;delete p;court next, r;while (p! = = null)r = p - next;delete p;p = r;head - next = null;void modify _ l (linklist head) / / 修改函数int n, m;linklist pre = 0, p = null;showmenu (1);court n;while (n 5)court
6、 n;p = checkdata (head, n );if (p = = null)return;showmenu (3);court m;court p child;break;case 2:court p brand;break;case 3:court p model;break;case 4:court p weight;break;case 5:court p value;break;case 6:court p );break;case 7:court p date;break;case 8:court p factory;break;case 9:court p child;c
7、ourt p brand;court p model;court p weight;court p value;court p );court p date;court p factory;break;court n;while (n 5)court n;check _ (head, n);void bubblesort (linklist head) / / 链表排序linklist p, p1, p2, endpt;p1 = head;for (endpt = null; endpt! = head; endpt = p)for (p = p1 = head; p1 - next - ne
8、xt! = endpt; p = p1 - next)if (check (p1 - next, p1 - next - next)p2 = p1 - next - next;p1 - next - next = p2 - next;p2 - next = p1 - next;p1 - next = p2.p = p1 - next - next;linklist checkdata (linklist head, int n, linklist pre = head;char brand 20.char model 20.court brand;court model;while (p! = = null)if (p - child = = n if (p = = null)pre = null;court n;while (n 5)court “ t输入错误 (1 - 5)“ endl;