2 doubly linked list Pushback/popfront2012-12-06 19:52 287 People read review (0) Favorite Report Category: Data structure (5)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.[CPP] View plain copy//implement calls and feature implementations separate doubly linked list #include "stdafx.h" Void builddata () { Person data; while (1) { scanf ("%d %s %s ",&data.iid, data.szname,data.szmajor); if ( data.iid<1) break; pushback (&data); } } void printdata () { Person data; while (Popfront (&data)) { printf ("id:%d,name:%s,major:%s\n", data.iid,data.szname,data.szmajor); } } int main () { builddata (); printdata (); return 0; }
[CPP] view plain copy//stack.h #if!defined __stack_h__ #define __STACK_H__ #include "stdafx.h" struct person {int iId; Char szname[16]; Char szmajor[16]; }; struct Node {person date; Node *pback; Node *pnext; }; void pushback (const person *pdate); BOOL Popfront (person *pdate); #endif
[CPP]