Language: C++

#include <cstdlib>
#include <iostream>
#include <string>
#include <typeinfo>
#include <stdio.h>
#include <string.h>#include <stack>
#include <sstream>
using namespace std;

void q87() {
	string inputs;
	for (; getline(cin,inputs);) {
		istringstream ss(inputs);
		stack<double> stk;
		string input;
		for (; getline(ss, input, ' ');) {
			if (input == "0" || atoi(input.c_str()) != 0) {
				stk.push((double)atoi(input.c_str()));
			}

			else {
				if (input == "+") {
					double b = stk.top(); stk.pop();
					double a = stk.top(); stk.pop();
					stk.push(a + b);
				}
				else if (input == "-") {
					double b = stk.top(); stk.pop();
					double a = stk.top(); stk.pop();
					stk.push(a - b);
				}
				else if (input == "*") {
					double b = stk.top(); stk.pop();
					double a = stk.top(); stk.pop();
					stk.push(a * b);
				}
				else if (input == "/") {
					double b = stk.top(); stk.pop();
					double a = stk.top(); stk.pop();
					stk.push(a / b);
				}
			}
		}
		cout << stk.top() << endl;
	}
}

int main() {
	q87();
	return 0;
}

Compiler output:
a.cc:6:20: warning: extra tokens at end of #include directive
    6 | #include <string.h>#include <stack>
      |                    ^
a.cc: In function 'void q87()':
a.cc:14:17: error: 'stack' was not declared in this scope
   14 |                 stack<double> stk;
      |                 ^~~~~
a.cc:8:1: note: 'std::stack' is defined in header '<stack>'; this is probably fixable by adding '#include <stack>'
    7 | #include <sstream>
  +++ |+#include <stack>
    8 | using namespace std;
a.cc:14:23: error: expected primary-expression before 'double'
   14 |                 stack<double> stk;
      |                       ^~~~~~
a.cc:18:33: error: 'stk' was not declared in this scope; did you mean 'std'?
   18 |                                 stk.push((double)atoi(input.c_str()));
      |                                 ^~~
      |                                 std
a.cc:23:52: error: 'stk' was not declared in this scope; did you mean 'std'?
   23 |                                         double b = stk.top(); stk.pop();
      |                                                    ^~~
      |                                                    std
a.cc:28:52: error: 'stk' was not declared in this scope; did you mean 'std'?
   28 |                                         double b = stk.top(); stk.pop();
      |                                                    ^~~
      |                                                    std
a.cc:33:52: error: 'stk' was not declared in this scope; did you mean 'std'?
   33 |                                         double b = stk.top(); stk.pop();
      |                                                    ^~~
      |                                                    std
a.cc:38:52: error: 'stk' was not declared in this scope; did you mean 'std'?
   38 |                                         double b = stk.top(); stk.pop();
      |                                                    ^~~
      |                                                    std
a.cc:44:25: error: 'stk' was not declared in this scope; did you mean 'std'?
   44 |                 cout << stk.top() << endl;
      |                         ^~~
      |                         std