Language: C++

#include<iostream>
#include<cstdlib>
#include<vector>
#include<string>

void push(int n,std::vector<int>& Stack){
  Stack.push_back(n);
}

int pop(std::vector<int>& Stack){
  int top=Stack.size();
  int x;

  x=Stack[top];
  Stack.pop_back();

  return x;
}

int main(){
  int x,y;
  std::vector<int> Stack;
  std::string c;

  while(std::cin>>c){
    if(c[0]=='+'){
      x=pop(Stack);
      y=pop(Stack);
      push(x+y,Stack);
    }else if(c[0]=='*'){
      x=pop(Stack);
      y=pop(Stack);
      push(x*y,Stack);
    }else if(c[0]=='-'){
      x=pop(Stack);
      y=pop(Stack);
      push(y-x,Stack);
    }else{
      push(std::atoi(c),Stack);
    }
  }

  std::cout<<Stack[0]<<'\n';

  return 0;
}

  
#include<iostream>
#include<cstdlib>
#include<vector>
#include<string>

void push(int n,std::vector<int>& Stack){
  Stack.push_back(n);
}

int pop(std::vector<int>& Stack){
  int top=Stack.size();
  int x;

  x=Stack[top];
  Stack.pop_back();

  return x;
}

int main(){
  int x,y;
  std::vector<int> Stack;
  std::string c;

  while(std::cin>>c){
    if(c[0]=='+'){
      x=pop(Stack);
      y=pop(Stack);
      push(x+y,Stack);
    }else if(c[0]=='*'){
      x=pop(Stack);
      y=pop(Stack);
      push(x*y,Stack);
    }else if(c[0]=='-'){
      x=pop(Stack);
      y=pop(Stack);
      push(y-x,Stack);
    }else{
      push(std::stoi(c),Stack);
    }
  }

  std::cout<<pop(Stack)<<'\n';

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:39:22: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
   39 |       push(std::atoi(c),Stack);
      |                      ^
      |                      |
      |                      std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/stdlib.h:105:30: note:   initializing argument 1 of 'int atoi(const char*)'
  105 | extern int atoi (const char *__nptr)
      |                  ~~~~~~~~~~~~^~~~~~
a.cc: At global scope:
a.cc:54:6: error: redefinition of 'void push(int, std::vector<int>&)'
   54 | void push(int n,std::vector<int>& Stack){
      |      ^~~~
a.cc:6:6: note: 'void push(int, std::vector<int>&)' previously defined here
    6 | void push(int n,std::vector<int>& Stack){
      |      ^~~~
a.cc:58:5: error: redefinition of 'int pop(std::vector<int>&)'
   58 | int pop(std::vector<int>& Stack){
      |     ^~~
a.cc:10:5: note: 'int pop(std::vector<int>&)' previously defined here
   10 | int pop(std::vector<int>& Stack){
      |     ^~~
a.cc:68:5: error: redefinition of 'int main()'
   68 | int main(){
      |     ^~~~
a.cc:20:5: note: 'int main()' previously defined here
   20 | int main(){
      |     ^~~~