39 lines
703 B
C
39 lines
703 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <math.h>
|
|
#include <ctype.h>
|
|
#include <string.h>
|
|
|
|
|
|
const int ERR_NS_OPERANDS = 1;
|
|
const int ERR_NS_OPERATORS = 2;
|
|
const int ERR_INVALID_INPUT = 4;
|
|
const int ERR_INVALID_FACTORIAL = 8;
|
|
const int ERR_DIV_BY_ZERO = 16;
|
|
|
|
|
|
struct EE_STACK_NODE {
|
|
double datum;
|
|
struct EE_STACK_NODE* tail;
|
|
};
|
|
typedef struct EE_STACK_NODE NODE;
|
|
typedef struct EE_STACK_NODE* STACK;
|
|
|
|
void push(double,STACK*);
|
|
void pop(STACK*);
|
|
double peek(STACK*);
|
|
|
|
int isNum(const char*);
|
|
int arrity(const char);
|
|
|
|
double evaluate(STACK*, char);
|
|
double* operands(STACK*, int);
|
|
double fact(int n);
|
|
|
|
void report(STACK*,char*);
|
|
|
|
|
|
|
|
|