怎样用c语言编一个简单的计算器?最简单的

来源:百度知道 编辑:UC知道 时间:2024/05/26 20:55:40

//简单计算器,含加减乘除、乘方运算。
#include<string.h>
#include<ctype.h>
#include<malloc.h> // malloc()等
#include<limits.h> // INT_MAX等
#include<stdio.h> // EOF(=^Z或F6),NULL
#include<stdlib.h> // atoi()
#include<io.h> // eof()
#include<math.h> // floor(),ceil(),abs()
#include<process.h> // exit()
#include<iostream.h> // cout,cin
// 函数结果状态代码
#define TRUE 1
#define FALSE 0
#define OK 1
#define ERROR 0
#define INFEASIBLE -1
// #define OVERFLOW -2 因为在math.h中已定义OVERFLOW的值为3,故去掉此行
typedef int Status; // Status是函数的类型,其值是函数结果状态代码,如OK等
typedef int Boolean; // Boolean是布尔类型,其值是TRUE或FALSE

#define STACK_INIT_SIZE 100
#define STACKINCREMENT 10

//***************************************************************************
//栈的储存结构

typedef struct{
//运算符栈
char *base;
char *top;
i