27 lines
440 B
C++
27 lines
440 B
C++
//Stack.h
|
|
|
|
#ifndef STACK_H
|
|
#define STACK_H
|
|
|
|
const int LEN = 80 ; // default stack length
|
|
class Stack {
|
|
// Interface
|
|
public:
|
|
Stack() { init(); }
|
|
~Stack() {}
|
|
int nitems() { return count ; }
|
|
bool full() { return (count==LEN) ; }
|
|
bool empty() { return (count==0) ; }
|
|
|
|
void push( double c );
|
|
double pop();
|
|
void inspect();
|
|
|
|
// Implementation
|
|
private:
|
|
void init() { count = 0 ; }
|
|
double s[LEN] ;
|
|
int count ;
|
|
|
|
};
|
|
#endif
|