Language: C++

#include<iostream>
#include<stdlib.h>
#include<stack>
#include<string>

int stpop(stack<int> s){
    int x;
    x=s.top();
    s.pop()
    return x;
}

int main(){
    int a,b;
    stack<int> s;
    string st;
    while(cin>>st){
        if(st[0]=='+'){
            a=stpop(s);
            b=stpop(s);
            s.push(a+b);
        }else if(st[0]=='*'){
            a=stpop(s);
            b=stpop(s);
            s.push(a*b);
        }else if(st[0]=='-'){
            a=stpop(s);
            b=stpop(s);
            s.push(b-a);
        }else{
            s.push(atoi(st.c_str()));
        }
    }
    cout<<s.top()<<endl;
}





Compiler output:
a.cc:6:11: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
    6 | int stpop(stack<int> s){
      |           ^~~~~
      |           std::stack
In file included from /usr/include/c++/14/stack:63,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_stack.h:99:11: note: 'std::stack' declared here
   99 |     class stack
      |           ^~~~~
a.cc:6:17: error: expected primary-expression before 'int'
    6 | int stpop(stack<int> s){
      |                 ^~~
a.cc: In function 'int main()':
a.cc:15:5: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
   15 |     stack<int> s;
      |     ^~~~~
      |     std::stack
/usr/include/c++/14/bits/stl_stack.h:99:11: note: 'std::stack' declared here
   99 |     class stack
      |           ^~~~~
a.cc:15:11: error: expected primary-expression before 'int'
   15 |     stack<int> s;
      |           ^~~
a.cc:16:5: error: 'string' was not declared in this scope
   16 |     string st;
      |     ^~~~~~
a.cc:16:5: 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:17:11: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   17 |     while(cin>>st){
      |           ^~~
      |           std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:17:16: error: 'st' was not declared in this scope; did you mean 'std'?
   17 |     while(cin>>st){
      |                ^~
      |                std
a.cc:19:21: error: 's' was not declared in this scope
   19 |             a=stpop(s);
      |                     ^
a.cc:19:22: error: 'stpop' cannot be used as a function
   19 |             a=stpop(s);
      |                      ^
a.cc:20:20: error: 'stpop' cannot be used as a function
   20 |             b=stpop(s);
      |               ~~~~~^~~
a.cc:23:21: error: 's' was not declared in this scope
   23 |             a=stpop(s);
      |                     ^
a.cc:23:22: error: 'stpop' cannot be used as a function
   23 |             a=stpop(s);
      |                      ^
a.cc:24:20: error: 'stpop' cannot be used as a function
   24 |             b=stpop(s);
      |               ~~~~~^~~
a.cc:27:21: error: 's' was not declared in this scope
   27 |             a=stpop(s);
      |                     ^
a.cc:27:22: error: 'stpop' cannot be used as a function
   27 |             a=stpop(s);
      |                      ^
a.cc:28:20: error: 'stpop' cannot be used as a function
   28 |             b=stpop(s);
      |               ~~~~~^~~
a.cc:31:13: error: 's' was not declared in this scope
   31 |             s.push(atoi(st.c_str()));
      |             ^
a.cc:34:5: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   34 |     cout<<s.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:34:11: error: 's' was not declared in this scope
   34 |     cout<<s.top()<<endl;
      |           ^
a.cc:34:20: error: 'endl' was not declared in this scope; did you mean 'std::endl'?
   34 |     cout<<s.top()<<endl;
      |                    ^~~~
      |                    std::endl
/usr/include/c++/14/ostream:744:5: note: 'std::endl' declared here
  744 |     endl(basic_ostream<_CharT, _Traits>& __os)
      |     ^~~~