Language: C++

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <ctime>
#include <stack>
#include <string>

using namespace std;

int main(void){
	string word;
	stack<int> S;

	while(cin >> word){
		if(word == "+"){
			int a, b;
			a = S.top;
			S.pop;
			b = S.top;
			S.pop;
			S.push(a + b);
		}else if(word == "-"){
			int a, b;
			a = S.top;
			S.pop;
			b = S.top;
			S.pop;
			S.push(a - b);
		}else if(word == "*"){
			int a, b;
			a = S.top;
			S.pop;
			b = S.top;
			S.pop;
			S.push(a * b);
		}else{
			S.push(int(word));
		}
	}

	cout << S.pop << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:31: error: cannot resolve overloaded function 'top' based on conversion to type 'int'
   20 |                         a = S.top;
      |                               ^~~
a.cc:21:27: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   21 |                         S.pop;
      |                         ~~^~~
In file included from /usr/include/c++/14/stack:63,
                 from a.cc:8:
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~
a.cc:22:31: error: cannot resolve overloaded function 'top' based on conversion to type 'int'
   22 |                         b = S.top;
      |                               ^~~
a.cc:23:27: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   23 |                         S.pop;
      |                         ~~^~~
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~
a.cc:27:31: error: cannot resolve overloaded function 'top' based on conversion to type 'int'
   27 |                         a = S.top;
      |                               ^~~
a.cc:28:27: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   28 |                         S.pop;
      |                         ~~^~~
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~
a.cc:29:31: error: cannot resolve overloaded function 'top' based on conversion to type 'int'
   29 |                         b = S.top;
      |                               ^~~
a.cc:30:27: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   30 |                         S.pop;
      |                         ~~^~~
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~
a.cc:34:31: error: cannot resolve overloaded function 'top' based on conversion to type 'int'
   34 |                         a = S.top;
      |                               ^~~
a.cc:35:27: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   35 |                         S.pop;
      |                         ~~^~~
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~
a.cc:36:31: error: cannot resolve overloaded function 'top' based on conversion to type 'int'
   36 |                         b = S.top;
      |                               ^~~
a.cc:37:27: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   37 |                         S.pop;
      |                         ~~^~~
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~
a.cc:40:32: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int'
   40 |                         S.push(int(word));
      |                                ^~~~~~~~~
a.cc:44:14: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = int; _Sequence = std::deque<int, std::allocator<int> >]'
   44 |         cout << S.pop << endl;
      |         ~~~~~^~~~~~~~
/usr/include/c++/14/bits/stl_stack.h:291:7: note: declared here
  291 |       pop()
      |       ^~~