Language: C++

/***
*	??´??°??????????????????????????????????????¢???????????????????????????
****/

//??????????????????????????¢??????
//#ifndef INTSTACH_H
#define INTSTACK_H

#include <iostream>
#include <stdlib.h>
using namespace std;

//-------------------------------------------------------
//		?????????????????????
class IntStack{
public:
	
	//????????????????????????IntStack??????????????§???????????????????????????????????????????????????????????????
	IntStack(int sz = 100){
		
		size = sz;
		//??????????????????????????°????????\????????¨???????????????????????????100??¨??????????????????????????????????????????
		
		stack = new int[size];
		//?????????????????????(size??????int??????)????????±?¨???¶?????????????????????
		
		sp=0;
		//??????????????????????????????????????????
	}
	
	~IntStack(){
		//?????????????????????IntStack???????????§????????????????????????????????????????????????????????????
		
		
		delete[] stack;
		//??????????????¬??????????????????
	}
	
	
	//???????????\
	void push(int value){
		
		//?????????????????????????????§??????
		if( sp >= size){
		cerr << "stack overflow" << endl;
			exit(1);
		}
		
		*(stack + sp) = value ;//value??????????????????????????????????????£??\(?)
		sp++;
	}
	
	//?????????
	void pop(int * p_value){
		//??¢??????????????????????????§??????
		if(sp <= 0){
			cerr << "stack underflow" << endl;
			exit(1);
		}
		
		sp--;
		*p_value = *(stack + sp);
	}
	//?????¨?????????????????????????????????
	int get_length(){
		return sp;
	}
	
	//???????????????????????????????????????????????????????????????????????????????´????????????????
	void peek(int * p_value, int offset = 0){
	//???????????????????????§??????
		if (offset >= sp){
			cerr << "stack underflow" << endl;
			exit(1);
		}
		
		//???????????????????´???????????????????
		*p_value = *(stack + sp - offset -1);
	}
	
private:
	
	//------------------------------------------
	//	???????????±
	//????????????????????????
	int sp;
	
	//?????????????????????
	int size;
	
	//????????????
	int *stack;
};
//#endif // INTSTACK_H

//----------------------------------------------------------------
//#include "Stack.h"

int main(int argc, char **argv)		//???????????¢??°
{
	int value ,  operand1, operand2 ;
	
	//???????????????????????¬??????????????????????????°??????????????????????????????
	IntStack(argc -1);
	
	//????????????????????°????????????????????\?????????????????\?°??????§?¨???°????????????????????????????¨??????????
	
	for(int i = 1 ; i < argc ; i++){
		
		//??????
		if(strcmp( argv[i], "+") == 0){
			ostack.pop( &operand2);		//??????2 ??? pop ??????
			ostack.pop( &operand1);		//??????1 ??? pop ??????
			ostack.push( operand1 + operand2);	//????????????????????? pop ??????
		}
		//??????
		else if(strcmp( argv[i], "-") == 0){
			ostack.pop( &operand2);
			ostack.pop( &operand1);
			ostack.push( operand1 - operand2);
		}
		
		//??????
		else if(strcmp( argv[i], "*") == 0){
			ostack.pop( &operand2);
			ostack.pop( &operand1);
			ostack.push( operand1 * operand2);
		}
		
		//??????
		else if(strcmp( argv[i], "/") == 0){
			ostack.pop( &operand2);
			ostack.pop( &operand1);
			
			//0??????
			if(operand2 == 0){
				cerr << "divid by 0" << endl;
				return 1;
			}
			
			ostack.push( operand1 / operand2);
		}
		
		//????¨???\????????´??°???????????????
		else {
			value = atoi(argv[i]);	//(?????????/??´??°??????)
			ostack.push(value);
		}
	}
	//?????????????????´?????§????¢????
	if(ostack.get_length() != 1){
		cerr << "illegal expression" << endl;
		return 1 ;
	}
	//?????????????????????
	ostack.pop(&value);
	cout << value << endl;
	
	//??£?????????
	return 0;
		//ostack????????????????????????????????¨??????????????????????????????????????????????????????
}

Compiler output:
a.cc:44:17: error: expected unqualified-id before 'if'
   44 |                 if( sp >= size){
      |                 ^~
a.cc:49:24: error: expected ')' before '+' token
   49 |                 *(stack + sp) = value ;//value??????????????????????????????????????£??\(?)
      |                  ~     ^~
      |                        )
a.cc:50:17: error: 'sp' does not name a type
   50 |                 sp++;
      |                 ^~
a.cc:51:10: error: expected ';' after class definition
   51 |         }
      |          ^
      |          ;
a.cc: In constructor 'IntStack::IntStack(int)':
a.cc:21:24: error: overloaded function with no contextual type information
   21 |                 size = sz;
      |                        ^~
a.cc:24:17: error: 'stack' was not declared in this scope
   24 |                 stack = new int[size];
      |                 ^~~~~
a.cc:11:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
   10 | #include <stdlib.h>
  +++ |+#include <stack>
   11 | using namespace std;
a.cc:24:33: error: expression in new-declarator must have integral or enumeration type
   24 |                 stack = new int[size];
      |                                 ^~~~
a.cc:27:17: error: 'sp' was not declared in this scope; did you mean 'sz'?
   27 |                 sp=0;
      |                 ^~
      |                 sz
a.cc: In destructor 'IntStack::~IntStack()':
a.cc:35:26: error: 'stack' was not declared in this scope
   35 |                 delete[] stack;
      |                          ^~~~~
a.cc:35:26: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
a.cc: In function 'void pop(int*)':
a.cc:56:20: error: 'sp' was not declared in this scope
   56 |                 if(sp <= 0){
      |                    ^~
a.cc:61:17: error: 'sp' was not declared in this scope
   61 |                 sp--;
      |                 ^~
a.cc:62:30: error: 'stack' was not declared in this scope
   62 |                 *p_value = *(stack + sp);
      |                              ^~~~~
a.cc:62:30: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
a.cc: In function 'int get_length()':
a.cc:66:24: error: 'sp' was not declared in this scope
   66 |                 return sp;
      |                        ^~
a.cc: In function 'void peek(int*, int)':
a.cc:72:31: error: 'sp' was not declared in this scope
   72 |                 if (offset >= sp){
      |                               ^~
a.cc:78:30: error: 'stack' was not declared in this scope
   78 |                 *p_value = *(stack + sp - offset -1);
      |                              ^~~~~
a.cc:78:30: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
a.cc:78:38: error: 'sp' was not declared in this scope
   78 |                 *p_value = *(stack + sp - offset -1);
      |                                      ^~
a.cc: At global scope:
a.cc:81:1: error: expected unqualified-id before 'private'
   81 | private:
      | ^~~~~~~
a.cc:93:1: error: expected declaration before '}' token
   93 | };
      | ^
a.cc: In function 'int main(int, char**)':
a.cc:111:20: error: 'strcmp' was not declared in this scope
  111 |                 if(strcmp( argv[i], "+") == 0){
      |                    ^~~~~~
a.cc:11:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
   10 | #include <stdlib.h>
  +++ |+#include <cstring>
   11 | using namespace std;
a.cc:112:25: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  112 |                         ostack.pop( &operand2);         //??????2 ??? pop ??????
      |                         ^~~~~~
      |                         stack
a.cc:118:25: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  118 |                         ostack.pop( &operand2);
      |                         ^~~~~~
      |                         stack
a.cc:125:25: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  125 |                         ostack.pop( &operand2);
      |                         ^~~~~~
      |                         stack
a.cc:132:25: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  132 |                         ostack.pop( &operand2);
      |                         ^~~~~~
      |                         stack
a.cc:147:25: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  147 |                         ostack.push(value);
      |                         ^~~~~~
      |                         stack
a.cc:151:12: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  151 |         if(ostack.get_length() != 1){
      |            ^~~~~~
      |            stack
a.cc:156:9: error: 'ostack' was not declared in this scope; did you mean 'stack'?
  156 |         ostack.pop(&value);
      |         ^~~~~~
      |         stack