Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct tstk {
- int inf;
- tstk *a;
- }*a, *b;
- tstk *AddStask(tstk *sp, int inf) {
- tstk *spt = new tstk;
- spt->inf = inf;
- spt->a = sp;
- return spt;
- }
- tstk *ReadStackD(tstk *sp, int &inf) {
- if (sp == NULL) return NULL;
- tstk *spt = sp;
- inf = sp->inf;
- sp = sp->a;
- delete spt;
- return sp;
- }
- tstk *DelStackAll(tstk *sp) {
- tstk *spt; int inf;
- while (sp != NULL) {
- spt = sp;
- inf = sp->inf;
- sp = sp->a;
- delete spt;
- }
- return NULL;
- }
- void RevStackAfter(tstk *sp)
- {
- tstk *spt = sp->a->a;
- sp->a->a = spt->a;
- spt->a = sp->a;
- sp->a = spt;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement