Language: C++

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>

int main() {

	vector<string> ary;
	string v;
	while (cin >> v)
	{
		ary.push_back(v);


	}
	stack<int>  stk;

	int sum = 0; int v1 = 0; int v2 = 0;
	for (int i = 0;i < ary.size();i++) {
		string val = ary[i];
		if (val == "+") {

			int v1 = stk.top();
			stk.pop();
			int v2 = stk.top();
			stk.pop();
			stk.push(v1 + v2);
		}
		else if (val == "-") {

			int v1 = stk.top();
			stk.pop();
			int v2 = stk.top();
			stk.pop();
			stk.push(v2 - v1);

		}
		else if (val == "*") {

			int v1 = stk.top();
			stk.pop();
			int v2 = stk.top();
			stk.pop();
			stk.push(v1 * v2);
		}
		else
		{
			stk.push(stoi(val));
		}
	}

	cout << stk.top() << endl;
	return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:9:9: error: 'vector' was not declared in this scope
    9 |         vector<string> ary;
      |         ^~~~~~
a.cc:9:9: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note:   'std::vector'
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
/usr/include/c++/14/vector:93:13: note:   'std::pmr::vector'
   93 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
a.cc:9:16: error: 'string' was not declared in this scope
    9 |         vector<string> ary;
      |                ^~~~~~
a.cc:9:16: note: suggested alternatives:
In file included from /usr/include/c++/14/iosfwd:41,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
In file included from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44:
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:9:24: error: 'ary' was not declared in this scope
    9 |         vector<string> ary;
      |                        ^~~
a.cc:10:15: error: expected ';' before 'v'
   10 |         string v;
      |               ^~
      |               ;
a.cc:11:16: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   11 |         while (cin >> v)
      |                ^~~
      |                std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:11:23: error: 'v' was not declared in this scope
   11 |         while (cin >> v)
      |                       ^
a.cc:17:9: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
   17 |         stack<int>  stk;
      |         ^~~~~
      |         std::stack
In file included from /usr/include/c++/14/stack:63,
                 from a.cc:5:
/usr/include/c++/14/bits/stl_stack.h:99:11: note: 'std::stack' declared here
   99 |     class stack
      |           ^~~~~
a.cc:17:15: error: expected primary-expression before 'int'
   17 |         stack<int>  stk;
      |               ^~~
a.cc:21:23: error: expected ';' before 'val'
   21 |                 string val = ary[i];
      |                       ^~~~
      |                       ;
a.cc:22:21: error: 'val' was not declared in this scope
   22 |                 if (val == "+") {
      |                     ^~~
a.cc:24:34: error: 'stk' was not declared in this scope; did you mean 'std'?
   24 |                         int v1 = stk.top();
      |                                  ^~~
      |                                  std
a.cc:32:34: error: 'stk' was not declared in this scope; did you mean 'std'?
   32 |                         int v1 = stk.top();
      |                                  ^~~
      |                                  std
a.cc:41:34: error: 'stk' was not declared in this scope; did you mean 'std'?
   41 |                         int v1 = stk.top();
      |                                  ^~~
      |                                  std
a.cc:49:25: error: 'stk' was not declared in this scope; did you mean 'std'?
   49 |                         stk.push(stoi(val));
      |                         ^~~
      |                         std
a.cc:49:34: error: 'stoi' was not declared in this scope; did you mean 'std::__cxx11::stoi'?
   49 |                         stk.push(stoi(val));
      |                                  ^~~~
      |                                  std::__cxx11::stoi
In file included from /usr/include/c++/14/string:54:
/usr/include/c++/14/bits/basic_string.h:4432:3: note: 'std::__cxx11::stoi' declared here
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
a.cc:53:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   53 |         cout << stk.top() << endl;
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:53:17: error: 'stk' was not declared in this scope; did you mean 'std'?
   53 |         cout << stk.top() << endl;
      |                 ^~~
      |                 std
a.cc:53:30: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   53 |         cout << stk.top() << endl;
      |                              ^~~~
      |                              std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~