80分求解决一个简单的C程序,该怎么处理

80分求解决一个简单的C程序
算术表达式求值(运算数为整数)
运算符为+,-,*,/,()
一是输入注意算术表达式

二是求表达式的值输出结果

谢谢     高手们!!!!!!!!!!!!


------解决方案--------------------
这可不算太简单,给出一个我的小程序包括4个文件,如下:

//calculator.h
/*==================================================
************简单的表达式求值c++语言的实现**************
==================================================*/

#ifndef _CALCULATOR_H_
#define _CALCULATOR_H_

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>

using namespace std;

//自定义的堆栈类
#include "stack.h "

struct entry //符号表的表项形式
{
char *lexptr;
int token;
};


class calculate //简单的一遍编译器类的定义
{
public:
calculate():lastchar(-1), lastentry(0),
lineno(1), tokenval(NONE)
{ }
~calculate()
{ }

public:
void init ();
void parse();
int getResult() //取得最后的计算结果
{
return st_value.top();
}

protected:
//保护成员函数声明
int lookup(char s[]);
int insert(char s[],int tok);
void error(char *m);
void emit(int t, int tval);
int lexan();

private:
//私有成员函数声明
void expr();
void term();
void factor();
void match(int t);

protected:
//类中使用的常量定义
static const int BSIZE = 128; //缓冲区大小
static const int NONE = -1;
static const char EOS = '\0 ';
static const int NUM = 256;
static const int DIV = 257;
static const int MOD = 258;
static const int ID = 259;
static const int DONE = 260;
static const int STRMAX = 999; //lexemes数组的大小
static const int SYMMAX = 100; //symtable的大小
private:
//私有成员变量声明
char lexemes[STRMAX] ;
int lastchar ; //lexmes的最后引用位置

entry symtable[SYMMAX] ;
int lastentry ;

char lexbuf[BSIZE] ;
int lineno ;
int tokenval ; //与记号关联的属性值
int lookahead ;

//存储表达式每一步的计算值
stack <double> st_value;
};

#endif

//stack.h
/*==========================================================
**********************自定义的堆栈类************************
==========================================================*/

#ifndef _STACK_H_
#define _STACK_H_

#include <deque>
#include <exception>
using namespace std;

template <typename T>
class stack
{
protected:
std::deque <T> c; //存放元素的容器

public:
class ReadEmptyStack:public std::exception
{
public:
virtual const char * what() const throw()
{
return "read empty stack ";
}
};
typename std::deque <T> ::size_type size() const
{
return c.size();
}
bool empty() const
{
return c.empty();
}

void push(const T& elem)
{
c.push_back(elem);
}

T pop()
{
if(c.empty())
{
throw ReadEmptyStack();
}
T elem(c.back());
c.pop_back();
return elem;
}

T& top()
{
if(c.empty())
{
throw ReadEmptyStack();
}
return c.back();
}
};
#endif



------解决方案--------------------
//calculator.cpp
//一遍编译器的实现文件

#include "calculator.h "