Home | Community | Message Board


This site includes paid links. Please support our sponsors.


Welcome to the Shroomery Message Board! You are experiencing a small sample of what the site has to offer. Please login or register to post messages and view our exclusive members-only content. You'll gain access to additional forums, file attachments, board customizations, encrypted private messages, and much more!

Shop: Unfolding Nature Unfolding Nature: Being in the Implicate Order   North Spore Injection Grain Bag   Mushroom-Hut Liquid Cultures   Kraken Kratom Red Vein Kratom

Jump to first unread post Pages: 1
Offlineencryptor
 User Gallery
Registered: 05/15/03
Posts: 1,154
Last seen: 18 days, 11 hours
Stacks and ADTs
    #5419265 - 03/19/06 04:12 PM (17 years, 10 months ago)

Hi, does anyone have any general c++ code on stacks with Abstract Data Types.  Like Push, Pop, SearchLink, DestroyLink, FillStack, and the Destructor.  Thanks.  I'm willing to help anyone in need of computer related resources.  peace :syringe: :mushroom2:


Extras: Filter Print Post Top
Offlinesupra
computerEnthusiast
Registered: 10/26/03
Posts: 6,446
Loc: TEXAS
Last seen: 12 years, 9 months
Re: Stacks and ADTs [Re: encryptor]
    #5419844 - 03/19/06 06:43 PM (17 years, 10 months ago)

if you made the abstract data types a class built upon stack, then in your main(), just make a variable of the ADT, and you should be set..

peace


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero

Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 20 days
Re: Stacks and ADTs [Re: supra]
    #5421200 - 03/20/06 03:22 AM (17 years, 10 months ago)

Do a search for standard template library.

Code:

//Afterwards x will have the same elements in the opposite order.
void reverse(string &x)
{
stack<char> s;
const int n=x.length();

//Put characters from x onto the stack
for(int i=0; i<n; ++i)
s.push(x[i]);

//take characters off of stack and put them back into x
for(int i=0; !s.empty(); ++i, s.pop())
x[i]=s.top();
}



--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
Offlineencryptor
 User Gallery
Registered: 05/15/03
Posts: 1,154
Last seen: 18 days, 11 hours
Re: Stacks and ADTs [Re: Seuss]
    #5421305 - 03/20/06 05:13 AM (17 years, 10 months ago)

That's sounds good, but my stack will only have integers.  No need for strings, but I like how that code is written.  peace :syringe: :mushroom2:


Extras: Filter Print Post Top
OfflineSeussA
Error: divide byzero

Folding@home Statistics
Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 20 days
Re: Stacks and ADTs [Re: encryptor]
    #5421327 - 03/20/06 05:40 AM (17 years, 10 months ago)

> That's sounds good, but my stack will only have integers. No need for strings, but I like how that code is written.

Code:

stack<int> myStack;



The standard template library uses C++ templates to implement the ADT independently of the data type being stored. In some cases, compare methods/operators must be provided for complex types.

Don't forget to include the proper STL headers and declare the correct namespace.

A good starting place: http://www.mochima.com/tutorials/STL.html


--------------------
Just another spore in the wind.


Extras: Filter Print Post Top
Offlineencryptor
 User Gallery
Registered: 05/15/03
Posts: 1,154
Last seen: 18 days, 11 hours
Re: Stacks and ADTs [Re: Seuss]
    #5440630 - 03/25/06 10:53 AM (17 years, 10 months ago)

Thanks for the advise!


Extras: Filter Print Post Top
Jump to top Pages: 1

Shop: Unfolding Nature Unfolding Nature: Being in the Implicate Order   North Spore Injection Grain Bag   Mushroom-Hut Liquid Cultures   Kraken Kratom Red Vein Kratom


Similar ThreadsPosterViewsRepliesLast post
* Format String Attack (you gotta be experienced with coding)
( 1 2 all )
Xeny 2,797 22 03/06/08 04:46 PM
by Diploid
* generating words based on a template OJK 625 3 01/04/05 04:22 PM
by ummikko
* Existing site as template ThePheonix 413 5 08/31/09 05:29 PM
by ThePheonix
* String Theory and Quantum Physics.
( 1 2 all )
ergot 5,216 24 01/03/04 01:02 AM
by MarioNett
* String Theory Silversoul 1,128 8 10/02/05 02:41 PM
by DieCommie
* Free Website Templates? Syle 751 8 12/03/09 11:55 AM
by frith
* Where can I find copyright free website templates? nice1 500 4 06/15/10 12:52 AM
by cortex
* Can Someone Give me a Flash Site Template Earth_Droid 761 3 01/25/03 04:08 PM
by rommstein2001

Extra information
You cannot start new topics / You cannot reply to topics
HTML is disabled / BBCode is enabled
Moderator: trendal, automan, Northerner
563 topic views. 0 members, 0 guests and 2 web crawlers are browsing this forum.
[ Show Images Only | Sort by Score | Print Topic ]
Search this thread:

Copyright 1997-2024 Mind Media. Some rights reserved.

Generated in 0.016 seconds spending 0.004 seconds on 12 queries.