Message-Id: <3.0.1.32.20001120155135.006abb34@wingate> X-Sender: n_abing#ns DOT roxas-online DOT net DOT ph AT wingate X-Mailer: Windows Eudora Pro Version 3.0.1 (32) Date: Mon, 20 Nov 2000 15:51:35 +0800 To: djgpp AT delorie DOT com From: "Nimrod A. Abing" Subject: Re: C++ stack Cc: lauris007 AT takas DOT lt In-Reply-To: <3a184d97@news.takas.lt> References: <3a1310ef AT news DOT takas DOT lt> <3a18034d AT news DOT takas DOT lt> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk At 12:00 AM 11/20/2000 +0200, you wrote: >Well, don't laugh at me, but i don't know... > >I just know i have to make something like a calculator with C+ and have to >use stack.. >Am i dumb or is it the lecturer who doesn't understand that it is impossible >to make a >stack programme with c+ ? You only think it's impossible because it seems that you have never tried. So if your instructor tells you to write a proggy using a stack and implement it in C++, you should ask yourself (and your instructor): Can I use (a) STL in this program or (b) do I have to implement a stack class myself? Is the program (a) TUI/GUI based or (b) command-line based? If you answered ``b'' to both questions, then you're almost done. Get the book by the man himself, ``C++ The Language'' by Bjarne Stroustrup, there's an example there that shows how to build a calculator program from the ground up. If you need to use STL, there is a stack abstract class there. If you need a GUI, get Allegro since it implements a simple dialog ``class'' in C. If you need a TUI, get the curses library. Also there are three notations used in calculator programs (command-line based): prefix, infix, and postfix notations. The first two are common. In prefix notation, operators precede operands and allows calculation without using parentheses (e.g. + A B). Postfix is similar to prefix, however operators follow the operands (e.g. A B +). Infix (e.g. A + B) is an interesting case in that most implementations just convert an infix expression into prefix or postfix to eliminate the need for parentheses in the final calculations. That should provide some insight into calculator programs. Now the important question (because you have not answered Damian's question): Are you using DJGPP (with STL) or Visual C++ (with MFC)? If you're using Visual C++, then I just wasted my time responding to a post by a future MicroSerf ;-P. Bye. nimrod_a_abing -------------- +========================================+ | Home page: www.geocities.com/n_abing | +========================================+