求一个C++程序(设计一个模拟计算器)

来源:百度知道 编辑:UC知道 时间:2024/09/28 14:58:01
题目要求:对包含加,减,乘,除,括号运算符及SQR和ABS函数的任意整型表达式进行求解

//author: ***
//course designing for data structures and program design in c++
//time:***
/*
a simulant calculator
description: requiring design a simulant calculator ,which could take operations such as +,-,*,/ ,( ),or functon SQR ,ABS
condition:inputted expression can limit into int type.therefore ,you must check the expression for exactness.if the errors
take place ,the program would give an alarm.

*/

#include<iostream>
#include<conio.h>
#include<stack>
#include<string>
#include<cstdlib>
#include<math.h>

using namespace std;
void init(string& s)
{
cout<<"enter the expression:";
cin>>s;
s+="#";
}

void error(int tag)
{
switch(tag)
{
case 1: