20 lines
		
	
	
		
			241 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			241 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "Stack01c.h"
 | |
| #define EMPTY (-1)
 | |
| 
 | |
| Stack::Stack() {
 | |
|     top=EMPTY;
 | |
| }
 | |
| 
 | |
| void Stack::push(int n) {
 | |
|     arr[++top] = n;
 | |
| }
 | |
| 
 | |
| int Stack::pop() {
 | |
|     return arr[top--];
 | |
| }
 | |
| 
 | |
| int Stack::isEmpty() {
 | |
|     return top == EMPTY;
 | |
| }
 | |
| 
 |