You can find answer in all of books of 数据结构
I have finish it with PrefixExpression (前缀表达式)with C++
I write two classes stac //just is stack , PrefixExpression
and use main.cpp to work this is the version of DOS
//stack.h
#include <iostream.h>
class stac
{
public:
stac(int n);
~stac();
void push(int x);
void pop();
int top();
bool isempty();
int ptop();
int Position();
int Length();
private:
int *ST;
int length;
int position;
};
void main()
{
char * expression;
cout<<"Please give your maths expression ."<<endl;
cout<<"For example :(10.+2.)-8.*50./2.+(2.+3.-211.*6.)@"<<endl;
cout<<"Don't forget the sign of end '@'"<<endl;
cin>>expression;
PrefixExpression fix(expression);
fix.change(expression);
fix.show();
fix.calculation ();
fix.output ();
}
//end all of program
this program only can deal with int expecially divide.
if some high programer can improve this program please write to me
dust2000@sohu.com