criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>

template <typename T, unsigned N>
    class stack {
    public:
        stack() : _data{new T[N]}, _top(0) {}
        ~stack() {delete[] _data;}
        T top() const {
            return _data[_top];
        }
        bool isEmpty() const {
            return _top == 0;
        }
        T pop() {
            assert(_top != 0);
            T data = this->top();
            _data[_top] = 0;
            --_top;
            return data;
        }
        void push(const T& x) {
            assert(_top < N);
            ++_top;
            _data[_top] = x;
        }
        bool isFull() const {
            return _top > N - 1;
        }
    private:
        T* _data;
        unsigned _top;
    };

  int evaluate(const std::vector<std::string>& vec)
    {
        stack<int, 3> stack;
        for (std::string v : vec) {
            if (v == "+") {
               stack.push(stack.pop() + stack.pop());
            }
            else if (v == "-") {
                stack.push(stack.pop() - stack.pop());
            }
            else if (v == "*") {
                stack.push(stack.pop() * stack.pop());
            }
            else {
                int i;
                std::istringstream ss(v);
                ss >> i;
                stack.push(i);
            }
            std::cout << "top is ";
            std::cout << stack.top() << std::endl;
            std::cout << " stack size is full ?"  << stack.isFull() << std::endl;
            std::cout << "stac size is " << stack.top() << std::endl;
        }
        return stack.pop();
    }

  std::string input;
   std::getline(std::cin, input);
   std::stringstream ss(input);
   std::vector<std::string> vec;
   std::copy(std::istream_iterator<std::string>(ss),
             {}, std::back_inserter(vec));

   int result = evaluate(vec);

Compiler output:
a.cc:65:16: error: expected constructor, destructor, or type conversion before '(' token
   65 |    std::getline(std::cin, input);
      |                ^
a.cc:68:13: error: expected constructor, destructor, or type conversion before '(' token
   68 |    std::copy(std::istream_iterator<std::string>(ss),
      |             ^
a.cc:69:16: error: expected unqualified-id before ',' token
   69 |              {}, std::back_inserter(vec));
      |                ^
a.cc:69:36: error: expected constructor, destructor, or type conversion before '(' token
   69 |              {}, std::back_inserter(vec));
      |                                    ^
Language: C++

#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <algorithm>

template <typename T, unsigned N>
    class stack {
    public:
        stack() : _data{new T[N]}, _top(0) {}
        ~stack() {delete[] _data;}
        T top() const {
            return _data[_top];
        }
        bool isEmpty() const {
            return _top == 0;
        }
        T pop() {
            assert(_top != 0);
            T data = this->top();
            _data[_top] = 0;
            --_top;
            return data;
        }
        void push(const T& x) {
            assert(_top < N);
            ++_top;
            _data[_top] = x;
        }
        bool isFull() const {
            return _top > N - 1;
        }
    private:
        T* _data;
        unsigned _top;
    };

  int evaluate(const std::vector<std::string>& vec)
    {
        stack<int, 3> stack;
        for (std::string v : vec) {
            if (v == "+") {
               stack.push(stack.pop() + stack.pop());
            }
            else if (v == "-") {
                stack.push(stack.pop() - stack.pop());
            }
            else if (v == "*") {
                stack.push(stack.pop() * stack.pop());
            }
            else {
                int i;
                std::istringstream ss(v);
                ss >> i;
                stack.push(i);
            }
            std::cout << "top is ";
            std::cout << stack.top() << std::endl;
            std::cout << " stack size is full ?"  << stack.isFull() << std::endl;
            std::cout << "stac size is " << stack.top() << std::endl;
        }
        return stack.pop();
    }

  std::string input;
   std::getline(std::cin, input);
   std::stringstream ss(input);
   std::vector<std::string> vec;
   std::copy(std::istream_iterator<std::string>(ss),
             {}, std::back_inserter(vec));

   int result = evaluate(vec);

Compiler output:
a.cc:66:16: error: expected constructor, destructor, or type conversion before '(' token
   66 |    std::getline(std::cin, input);
      |                ^
a.cc:69:13: error: expected constructor, destructor, or type conversion before '(' token
   69 |    std::copy(std::istream_iterator<std::string>(ss),
      |             ^
a.cc:70:16: error: expected unqualified-id before ',' token
   70 |              {}, std::back_inserter(vec));
      |                ^
a.cc:70:36: error: expected constructor, destructor, or type conversion before '(' token
   70 |              {}, std::back_inserter(vec));
      |                                    ^
Language: C++

#include <iostream>
#include <vector>
#include <cassert>
#include <algorithm>
#include <sstream>

template <typename T, unsigned N>
    class stack {
    public:
        stack() : _data{new T[N]}, _top(0) {}
        ~stack() {delete[] _data;}
        T top() const {
            return _data[_top];
        }
        bool isEmpty() const {
            return _top == 0;
        }
        T pop() {
            assert(_top != 0);
            T data = this->top();
            _data[_top] = 0;
            --_top;
            return data;
        }
        void push(const T& x) {
            assert(_top < N);
            ++_top;
            _data[_top] = x;
        }
        bool isFull() const {
            return _top > N - 1;
        }
    private:
        T* _data;
        unsigned _top;
    };

  int evaluate(const std::vector<std::string>& vec)
    {
        stack<int, 3> stack;
        for (std::string v : vec) {
            if (v == "+") {
               stack.push(stack.pop() + stack.pop());
            }
            else if (v == "-") {
                stack.push(stack.pop() - stack.pop());
            }
            else if (v == "*") {
                stack.push(stack.pop() * stack.pop());
            }
            else {
                int i;
                std::istringstream ss(v);
                ss >> i;
                stack.push(i);
            }
            std::cout << "top is ";
            std::cout << stack.top() << std::endl;
            std::cout << " stack size is full ?"  << stack.isFull() << std::endl;
            std::cout << "stac size is " << stack.top() << std::endl;
        }
        return stack.pop();
    }

  std::string input;
   std::getline(std::cin, input);
   std::stringstream ss(input);
   std::vector<std::string> vec;
   std::copy(std::istream_iterator<std::string>(ss),
             {}, std::back_inserter(vec));

   int result = evaluate(vec);

Compiler output:
a.cc:66:16: error: expected constructor, destructor, or type conversion before '(' token
   66 |    std::getline(std::cin, input);
      |                ^
a.cc:69:13: error: expected constructor, destructor, or type conversion before '(' token
   69 |    std::copy(std::istream_iterator<std::string>(ss),
      |             ^
a.cc:70:16: error: expected unqualified-id before ',' token
   70 |              {}, std::back_inserter(vec));
      |                ^
a.cc:70:36: error: expected constructor, destructor, or type conversion before '(' token
   70 |              {}, std::back_inserter(vec));
      |                                    ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int top,S[1000];
void push(int x){
  S[++top]=x;
}
int pop(int x){
  top--;
  return S[top+1];
}
int main(){
  int a,b;
  top=0;
  char ch[1000];
  while(scanf("%s",&ch)!=EOF){
    if(ch=='+'){
      a=pop();
      b=pop();
      push(a+b);
    } else if(ch=='-'){
      a=pop();
      b=pop();
      push(a-b);
    } else if(ch=='*'){
      a=pop();
      b=pop();
      push(a*b);
    } else {
      push(atoi(ch));
    }
  }
  printf("%d\n",pop());
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:10: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   17 |     if(ch=='+'){
      |        ~~^~~~~
a.cc:18:12: error: too few arguments to function 'int pop(int)'
   18 |       a=pop();
      |         ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
a.cc:19:12: error: too few arguments to function 'int pop(int)'
   19 |       b=pop();
      |         ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
a.cc:21:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   21 |     } else if(ch=='-'){
      |               ~~^~~~~
a.cc:22:12: error: too few arguments to function 'int pop(int)'
   22 |       a=pop();
      |         ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
a.cc:23:12: error: too few arguments to function 'int pop(int)'
   23 |       b=pop();
      |         ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
a.cc:25:17: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   25 |     } else if(ch=='*'){
      |               ~~^~~~~
a.cc:26:12: error: too few arguments to function 'int pop(int)'
   26 |       a=pop();
      |         ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
a.cc:27:12: error: too few arguments to function 'int pop(int)'
   27 |       b=pop();
      |         ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
a.cc:33:20: error: too few arguments to function 'int pop(int)'
   33 |   printf("%d\n",pop());
      |                 ~~~^~
a.cc:8:5: note: declared here
    8 | int pop(int x){
      |     ^~~
Language: C++

#include <iostream>
#include <stack>      //std::stack
#include <string>
#include <stdlib.h>
using namespace std;
std::stack<int> myStack;

int dataPop(void)
{
	int data = myStack.top();
	myStack.pop();
	return data;
}

void calcAndPush(string container)
{
    int data01, data02;
	if(container == "+")             //addition
	{
		data01 = data_pop();
		data02 = data_pop();
		myStack.push(data01+data02);
	}
	else if(container == "-")         //subtraction
	{
		data01 = data_pop();
		data02 = data_pop();
		myStack.push(data02-data01);
	}
	else if(container == "*")       //multiplication
	{
		data01 = data_pop();
		data02 = data_pop();
		myStack.push(data01*data02);
	}
	else
	{
		myStack.push(atoi(container.c_str()));
	}
	return;
}

int main(void)
{
	string container;
	int count = 0;			// mojisuu
	int containerSize = 0;  // stack yousosuu

	while(cin >> container)
	{
		count++;
		containerSize = myStack.size();
		if(count > 2)
		{
			if(containerSize >= 2)
			{
				calcAndPush(container);
			}
			else
			{
				myStack.push(atoi(container.c_str()));
			}
            
		}
		else
		{
			myStack.push(atoi(container.c_str()));
		}
	}
   
	//result
	if(containerSize < 2)
	{
		myStack.pop();			//Exile the last element
	}
	cout << myStack.top() << endl;		//Calculation result
	return 0;
}

Compiler output:
a.cc: In function 'void calcAndPush(std::string)':
a.cc:20:26: error: 'data_pop' was not declared in this scope; did you mean 'dataPop'?
   20 |                 data01 = data_pop();
      |                          ^~~~~~~~
      |                          dataPop
a.cc:26:26: error: 'data_pop' was not declared in this scope; did you mean 'dataPop'?
   26 |                 data01 = data_pop();
      |                          ^~~~~~~~
      |                          dataPop
a.cc:32:26: error: 'data_pop' was not declared in this scope; did you mean 'dataPop'?
   32 |                 data01 = data_pop();
      |                          ^~~~~~~~
      |                          dataPop
Language: C++

#include <iostream>
#include <cstdlib>
#include <stack>
using namespace std;
int main(){
  int a,b;
  string ch;
  srack<int> S;
  while(scanf("%s",ch)!=EOF){
    if(ch[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    } else if(ch[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    } else if(ch[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    } else {
      S.push(atoi(ch.c_str()));
    }
  }
  printf("%d\n",S.top());
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'srack' was not declared in this scope
    8 |   srack<int> S;
      |   ^~~~~
a.cc:8:9: error: expected primary-expression before 'int'
    8 |   srack<int> S;
      |         ^~~
a.cc:11:9: error: 'S' was not declared in this scope
   11 |       a=S.top();S.pop();
      |         ^
a.cc:15:9: error: 'S' was not declared in this scope
   15 |       b=S.top();S.pop();
      |         ^
a.cc:19:9: error: 'S' was not declared in this scope
   19 |       a=S.top();S.pop();
      |         ^
a.cc:23:7: error: 'S' was not declared in this scope
   23 |       S.push(atoi(ch.c_str()));
      |       ^
a.cc:26:17: error: 'S' was not declared in this scope
   26 |   printf("%d\n",S.top());
      |                 ^
Language: C++

#include <stdio.h>
#include <cstdlib>
#include <stack>
using namespace std;
int main(){
  int a,b;
  string ch;
  stack<int> S;
  while(scanf("%s",ch)!=EOF){
    if(ch[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    } else if(ch[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    } else if(ch[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    } else {
      S.push(atoi(ch.c_str()));
    }
  }
  printf("%d\n",S.top());
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:3: error: 'string' was not declared in this scope
    7 |   string ch;
      |   ^~~~~~
a.cc:4:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
    3 | #include <stack>
  +++ |+#include <string>
    4 | using namespace std;
a.cc:9:20: error: 'ch' was not declared in this scope
    9 |   while(scanf("%s",ch)!=EOF){
      |                    ^~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <stack>
int main(){
  int a,b;
  string ch;
  stack<int> S;
  while(scanf("%s",ch)!=EOF){
    if(ch[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    } else if(ch[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    } else if(ch[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    } else {
      S.push(atoi(ch.c_str()));
    }
  }
  printf("%d\n",S.top());
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'string' was not declared in this scope; did you mean 'stdin'?
    6 |   string ch;
      |   ^~~~~~
      |   stdin
a.cc:7:3: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
    7 |   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:7:9: error: expected primary-expression before 'int'
    7 |   stack<int> S;
      |         ^~~
a.cc:8:20: error: 'ch' was not declared in this scope
    8 |   while(scanf("%s",ch)!=EOF){
      |                    ^~
a.cc:10:9: error: 'S' was not declared in this scope
   10 |       a=S.top();S.pop();
      |         ^
a.cc:14:9: error: 'S' was not declared in this scope
   14 |       b=S.top();S.pop();
      |         ^
a.cc:18:9: error: 'S' was not declared in this scope
   18 |       a=S.top();S.pop();
      |         ^
a.cc:22:7: error: 'S' was not declared in this scope
   22 |       S.push(atoi(ch.c_str()));
      |       ^
a.cc:25:17: error: 'S' was not declared in this scope
   25 |   printf("%d\n",S.top());
      |                 ^
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostrem>
#include <stack>
using namespace std;
int main(){
  int a,b;
  char ch[1000];
  stack<int> S;
  while(scanf("%s",ch)!=EOF){
    if(ch[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    } else if(ch[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    } else if(ch[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    } else {
      S.push(atoi(ch.c_str()));
    }
  }
  printf("%d\n",S.top());
  return 0;
}

Compiler output:
a.cc:3:10: fatal error: iostrem: No such file or directory
    3 | #include <iostrem>
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stack>
using namespace std;
int main(){
  int a,b;
  char ch[1000];
  stack<int> S;
  while(scanf("%s",ch)!=EOF){
    if(ch[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    } else if(ch[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    } else if(ch[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    } else {
      S.push(atoi(ch.c_str()));
    }
  }
  printf("%d\n",S.top());
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:24:22: error: request for member 'c_str' in 'ch', which is of non-class type 'char [1000]'
   24 |       S.push(atoi(ch.c_str()));
      |                      ^~~~~
Language: C++

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <stack>
int main(){
  int a,b;
  char ch[1000];
  stack<int> S;
  while(scanf("%s",ch)!=EOF){
    if(ch[0]=='+'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a+b);
    } else if(ch[0]=='-'){
      b=S.top();S.pop();
      a=S.top();S.pop();
      S.push(a-b);
    } else if(ch[0]=='*'){
      a=S.top();S.pop();
      b=S.top();S.pop();
      S.push(a*b);
    } else {
      S.push(atoi(ch));
    }
  }
  printf("%d\n",S.top());
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:3: error: 'stack' was not declared in this scope; did you mean 'std::stack'?
    8 |   stack<int> S;
      |   ^~~~~
      |   std::stack
In file included from /usr/include/c++/14/stack:63,
                 from a.cc:4:
/usr/include/c++/14/bits/stl_stack.h:99:11: note: 'std::stack' declared here
   99 |     class stack
      |           ^~~~~
a.cc:8:9: error: expected primary-expression before 'int'
    8 |   stack<int> S;
      |         ^~~
a.cc:11:9: error: 'S' was not declared in this scope
   11 |       a=S.top();S.pop();
      |         ^
a.cc:15:9: error: 'S' was not declared in this scope
   15 |       b=S.top();S.pop();
      |         ^
a.cc:19:9: error: 'S' was not declared in this scope
   19 |       a=S.top();S.pop();
      |         ^
a.cc:23:7: error: 'S' was not declared in this scope
   23 |       S.push(atoi(ch));
      |       ^
a.cc:26:17: error: 'S' was not declared in this scope
   26 |   printf("%d\n",S.top());
      |                 ^
Language: C++

#include <iostream>
#include <stack>

using namespace std;

char s[100];

int main(){
	stack<int> st;
	while(~scanf("%s", s)){
		if(s[0]=='+'){
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(a+b);
		}
		else if(s[0]=='-'){
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(b-a);	
		}
		else if(s[0]=='*'){
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(a*b);	
		}
		else{
			int tmp = 0;
			for(int i=0; i<len(s); i++){
				tmp *= 10;
				tmp += s[i]-'0';
			}
			st.push(tmp);
		}
	}
	cout<<st.top()<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:40: error: 'len' was not declared in this scope; did you mean 'mblen'?
   34 |                         for(int i=0; i<len(s); i++){
      |                                        ^~~
      |                                        mblen
Language: C++

#include <iostream>
#include <stack>

using namespace std;

char s[100];

int main(){
	stack<int> st;
	while(~scanf("%s", s)){
		if(s[0]=='+'){
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(a+b);
		}
		else if(s[0]=='-'){
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(b-a);	
		}
		else if(s[0]=='*'){
			int a = st.top();
			st.pop();
			int b = st.top();
			st.pop();
			st.push(a*b);	
		}
		else{
			int tmp = 0;
			for(int i=0; i<strlen(s); i++){
				tmp *= 10;
				tmp += s[i]-'0';
			}
			st.push(tmp);
		}
	}
	cout<<st.top()<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:40: error: 'strlen' was not declared in this scope
   34 |                         for(int i=0; i<strlen(s); i++){
      |                                        ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
    2 | #include <stack>
  +++ |+#include <cstring>
    3 |
Language: C++

#include<iostream>
#include<cstdio>

using namespace std;

int top, S[1000];

void push(int x){
	top++;
	S[top] = x;
}

int pop() {
	top--;
	return S[top + 1];
}

int main() {
	int a, b;
	top = 0;
	char s[100];
	while (scanf_s("%s",s)!=EOF) {
		if (s[0] == '+') {
			a = pop();
			b = pop();
			push(a + b);
		}
		else if (s[0] == '-') {
			a = pop();
			b = pop();
			push(a - b);
		}
		else if (s[0] == '*') {
			a = pop();
			b = pop();
			push(a*b);
		}
		else {
			push(atoi(s));
		}
	}
	printf("%d", pop());

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   22 |         while (scanf_s("%s",s)!=EOF) {
      |                ^~~~~~~
      |                scanf
Language: C++

#include<iostream>
#include<cstdio>
#include<stack>
using namespace std;

int main() {
	stack<int>S;
	int a, b, c;
	string s;

	while (cin >> s) {
		if (s[0] == '+') {
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a + b);
		}
		else if (s[0] == '-') {
			b = S.top(); S.pop();
			a = S.top(); S.pop();
			S.push(a - b);
		}
		else if (s[0] == '*') {
			a = S.top(); S.pop();
			b = S.top();S.pop();
			S.push(a*b);
		}
		else {
			S.push(atoi(s.~_String_alloc()));
		}
	}

	cout << S.top() << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:28:53: error: expected class-name before '(' token
   28 |                         S.push(atoi(s.~_String_alloc()));
      |                                                     ^
Language: C++

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
typedef float Item;
static Item *s;
static int N;
void STACKinit(int);
int STACKempty(void);
void STACKpush(Item);
Item STACKpop(void);
int main(void){
  char a[300];
  int i=0;
  scanf("%[^\n]",a);
  int n=strlen(a);
  int stackin=0;
  STACKinit(214748364);
  for(i=0;i<n;i++){
    if(a[i]=='+'){
      STACKpush(STACKpop()+STACKpop());
      stackin--;
      printf("stackin=%d\n",stackin);
    }
    if(a[i]=='-'){
      int l=STACKpop();
      STACKpush(STACKpop()-l);
    }
    if(a[i]=='*'){
      STACKpush(STACKpop()*STACKpop());
    }
    if((a[i]>='0')&&(a[i]<='9')){
      STACKpush(0);
    }
    while((a[i]>='0')&&(a[i]<='9')){
      STACKpush(10*STACKpop()+(a[i++]-'0'));
      stackin++;
      printf("stackin=%d\n",stackin);
    }
  }
  printf("%d\n",(int)STACKpop());
  return 0;
}
void STACKinit(int maxN){
  s=malloc(maxN*sizeof(Item));
  N=0;
}
int STACKempty(void){
  return N==0;
}
void STACKpush(Item item){
  s[N++]=item;
}
Item STACKpop(void){
  return s[--N];
}

Compiler output:
a.cc: In function 'void STACKinit(int)':
a.cc:44:11: error: invalid conversion from 'void*' to 'Item*' {aka 'float*'} [-fpermissive]
   44 |   s=malloc(maxN*sizeof(Item));
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~
      |           |
      |           void*
Language: C++

#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<stack>
#include<string>


#define REP(i,n) for(int (i)=0;i<(n);i++)


using namespace std;



int main(){
  stack <int>is;
  int a,b,x;
  string s;
  while(){
    if(s[0] == '+'){
        a = is.top();is.pop();
        b = is.top();is.pop();
        is.push(a+b);
      }
    else if(s[0] == '-'){
        a = is.top(); is.pop();
        b = is.top(); is.pop();
        is.push(b-a);
      }
  else if(s[0] == '*'){
      a = is.top();is.pop();
      b = is.top();is.pop();
      is.push(a*b);
    }
  else{
    is.push(atoi(s.c_str()));
  }
  }

  printf("%d\n",is.top());

  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:9: error: expected primary-expression before ')' token
   19 |   while(){
      |         ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000]

void push(int x) {
/* topを加算してからその位置へ挿入 */
  S[++top] = x
}

int pop() {
  top--;
/* topが指していた要素を返す */
  return S[top+1];
}

int main() {
  int a, b;
  top = 0;
  char s[100];

  while( scanf("%s", s) != EOF ) {
    if ( s[0] == '+' ) {
      a = pop();
      b = pop();
      push(a + b);
    } else if ( s[0] == '-') {
      b = pop();
      a = pop();
      push(a * b);
    } else if ( s[0] == '*' ) {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }

  printf("%d\n", pop());

  return 0;
}


Compiler output:
a.cc:7:1: error: expected initializer before 'void'
    7 | void push(int x) {
      | ^~~~
a.cc: In function 'int pop()':
a.cc:15:10: error: 'S' was not declared in this scope
   15 |   return S[top+1];
      |          ^
a.cc: In function 'int main()':
a.cc:27:7: error: 'push' was not declared in this scope
   27 |       push(a + b);
      |       ^~~~
a.cc:31:7: error: 'push' was not declared in this scope
   31 |       push(a * b);
      |       ^~~~
a.cc:35:7: error: 'push' was not declared in this scope
   35 |       push(a * b);
      |       ^~~~
a.cc:37:7: error: 'push' was not declared in this scope
   37 |       push(atoi(s));
      |       ^~~~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
 
int top, S[1000]
 
void push(int x) {
/* topを加算してからその位置へ挿入 */
  S[++top] = x;
}
 
int pop() {
  top--;
/* topが指していた要素を返す */
  return S[top+1];
}
 
int main() {
  int a, b;
  top = 0;
  char s[100];
 
  while( scanf("%s", s) != EOF ) {
    if ( s[0] == '+' ) {
      a = pop();
      b = pop();
      push(a + b);
    } else if ( s[0] == '-') {
      b = pop();
      a = pop();
      push(a * b);
    } else if ( s[0] == '*' ) {
      a = pop();
      b = pop();
      push(a * b);
    } else {
      push(atoi(s));
    }
  }
 
  printf("%d\n", pop());
 
  return 0;
}


Compiler output:
a.cc:7:1: error: expected initializer before 'void'
    7 | void push(int x) {
      | ^~~~
a.cc: In function 'int pop()':
a.cc:15:10: error: 'S' was not declared in this scope
   15 |   return S[top+1];
      |          ^
a.cc: In function 'int main()':
a.cc:27:7: error: 'push' was not declared in this scope
   27 |       push(a + b);
      |       ^~~~
a.cc:31:7: error: 'push' was not declared in this scope
   31 |       push(a * b);
      |       ^~~~
a.cc:35:7: error: 'push' was not declared in this scope
   35 |       push(a * b);
      |       ^~~~
a.cc:37:7: error: 'push' was not declared in this scope
   37 |       push(atoi(s));
      |       ^~~~
Language: C++

#include<iostram>
#include<cstdlib>
#include<stack>

using namespace std;

int main() {
  stack<int> S;
  int a, b, x;
  string s;

  while ( cin >> s ){
    if ( s[0] == '+' ) {
      a = S.top(); S.pop();
      b = S.top(); S.pop();
      S.push(a + b);
    } else if ( s[0] == '-' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a - b);
    } else if ( s[0] == '*' ) {
      a = S.top(); S.pop();
      b = S.top(); S.pop();
      S.push(a * b);
    } else {
      S.push(atoi(s.c_str()));
    }
  }
  cout << S.top() << endl;

  return 0;
}

  


Compiler output:
a.cc:1:9: fatal error: iostram: No such file or directory
    1 | #include<iostram>
      |         ^~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <string>
using namespace std;

int const MAX = 100;
int top;
int s[MAX];

void initalise() {
  top = 0;
}

bool isEmpty() {
  return top == 0;
}

bool isFull() {
  return top >= MAX - 1;
}

void push(int x) {
  if (isFull()) cout << "エラー(オーバーフロー)" << endl;
  top++;
  s[top] = x;
}

int pop() {
  if (isEmpty()) cout << "エラー(アンダーフロー)" << endl;
  top--;
  return s[top + 1];
}

int main() {
  using ite_t = istream_iterator<string>;
  ite_t it(cin);
  ite_t last;

  while (it != last) {
    if (*it == "+") {
      push(pop() + pop());
    } else if (*it == "-") {
      push(-pop() + pop());
    } else if (*it == "*") {
      push(pop() * pop());
    } else {
      push(stoi(*it));
    }
    it++;
  }

  cout << pop() << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:17: error: 'istream_iterator' does not name a type
   35 |   using ite_t = istream_iterator<string>;
      |                 ^~~~~~~~~~~~~~~~
a.cc:36:3: error: 'ite_t' was not declared in this scope; did you mean 'time_t'?
   36 |   ite_t it(cin);
      |   ^~~~~
      |   time_t
a.cc:37:8: error: expected ';' before 'last'
   37 |   ite_t last;
      |        ^~~~~
      |        ;
a.cc:39:10: error: 'it' was not declared in this scope; did you mean 'int'?
   39 |   while (it != last) {
      |          ^~
      |          int
a.cc:39:16: error: 'last' was not declared in this scope
   39 |   while (it != last) {
      |                ^~~~
Language: C++

#include<bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

struct Stack{
	ll table[1000];
	ll top;
	void init(){
		top=0;
	}
	bool empty(){
		return top==0;
	}
	void push(ll x){
		table[top]=x;
		top++;
	}
	ll pop(){
		if(empty()) return 0;
		top--;
		return table[top];
	}
};

ll calc(ll x,string op,ll y){
	if(op=="+")return x+y;
	if(op=="-")return x-y;
	if(op=="*")return x*y;
}

int main(){
	string str;
	Stack stack;
	ll numA,numB;
	stack,init();
	while(cin >> str){
		if(str=="+"||str=="-"||str=="+"){
			numA=stack.pop();
			numB=stack.pop();
			stack.push(calc(numB,str,numA));
		}else{
			numA=0;
			for(int i=0;i<(int)str.size();i++){
				numA*=10;
				numA+=str[i]-'0';
				}
			stack.push(numA);
		}
	}
	cout << stack.pop()<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:15: error: 'init' was not declared in this scope; did you mean 'int'?
   37 |         stack,init();
      |               ^~~~
      |               int
a.cc: In function 'll calc(ll, std::string, ll)':
a.cc:31:1: warning: control reaches end of non-void function [-Wreturn-type]
   31 | }
      | ^
Language: C++

#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

class Stack{
public:
	int S[101];
	int top;

	Stack();
	void push(int x);
	int pop();
	bool isEmpty();
	bool isFull();
};

Stack::Stack(){
	S[0] = 0;
	top = 0;
	return;
}

void Stack::push(int x){
	top++;
	S[top] = x;
	return;
}

int Stack::pop(){
	top--;
	if (top > -1) return S[top + 1];
	return -1;
}

bool Stack::isEmpty(){
	return (top == 0);
}

bool Stack::isFull(){
	return (top == 100);
}

int main(){
	Stack s;
	string text, w;
	int dum, last;
	int pos = 0;
	int rpos;
	getline(cin, text);
	last = 0;
	while (true){
		rpos = pos;
		pos = text.find(" ", pos);
		if (pos == string::npos){
			last = 1;
			pos = text.length();
		}
		w = text.substr(rpos, pos - rpos);
		if (w == "+"){
			dum = s.pop() + s.pop();
			s.push(dum);
		}
		else if (w == "-"){
			dum = - s.pop() + s.pop();
			s.push(dum);
		}
		else if (w == "*"){
			dum = s.pop() * s.pop();
			s.push(dum);
		}
		else{
			sscanf_s(w.data(), "%d", &dum);
			s.push(dum);
		}
		pos++;
		if (last == 1) break;
	}
	cout << s.pop() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:25: error: 'sscanf_s' was not declared in this scope; did you mean 'sscanf'?
   73 |                         sscanf_s(w.data(), "%d", &dum);
      |                         ^~~~~~~~
      |                         sscanf
Language: C++

#include <iostream>
#include <string>
#include <cstdio>
using namespace std;

class Stack{
public:
	int S[101];
	int top;

	Stack();
	void push(int x);
	int pop();
	bool isEmpty();
	bool isFull();
};

Stack::Stack(){
	S[0] = 0;
	top = 0;
	return;
}

void Stack::push(int x){
	top++;
	S[top] = x;
	return;
}

int Stack::pop(){
	top--;
	if (top > -1) return S[top + 1];
	return -1;
}

bool Stack::isEmpty(){
	return (top == 0);
}

bool Stack::isFull(){
	return (top == 100);
}

int main(){
	Stack s;
	string text, w;
	int dum, last;
	int pos = 0;
	int rpos;
	getline(cin, text);
	last = 0;
	while (true){
		rpos = pos;
		pos = text.find(" ", pos);
		if (pos == string::npos){
			last = 1;
			pos = text.length();
		}
		w = text.substr(rpos, pos - rpos);
		if (w == "+"){
			dum = s.pop() + s.pop();
			s.push(dum);
		}
		else if (w == "-"){
			dum = - s.pop() + s.pop();
			s.push(dum);
		}
		else if (w == "*"){
			dum = s.pop() * s.pop();
			s.push(dum);
		}
		else{
			sscanf_s(w.data(), "%d", &dum);
			s.push(dum);
		}
		pos++;
		if (last == 1) break;
	}
	cout << s.pop() << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:25: error: 'sscanf_s' was not declared in this scope; did you mean 'sscanf'?
   73 |                         sscanf_s(w.data(), "%d", &dum);
      |                         ^~~~~~~~
      |                         sscanf
Language: C++

#include <stdio.h>
#include <stack>

using namespace std;

stack<int> S;

int main() {
    int a, b;
    char str[1000];
    while(~scanf("%s", str)) {
        if(str[0] == '+') {
            a = S.top();S.pop();
            b = S.top();S.pop();
            S.push(a+b);
        } else if(str[0] == '-') {
            a = S.top();S.pop();
            b = S.top();S.pop();
            S.push(a-b);
        } else if(str[0] == '*') {
            a = S.top();S.pop();
            b = S.top();S.pop();
            S.push(a*b);
        } else if(str[0] == '/') {
            a = S.top();S.pop();
            b = S.top();S.pop();
            S.push(a/b);
        } else {
            S.push(atoi(str));
        }
        printf("%d\n", S.top());
        S.pop();
    }
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:29:20: error: 'atoi' was not declared in this scope
   29 |             S.push(atoi(str));
      |                    ^~~~
Language: C++

#include <iostream>
#include <stack>
#include <string>
#include <cstdlib>
using namespace std;
 
stack<int> s;

/*
<stack>で使うもの
empty()　→　コンテナが空かどうかチェック
pop()　  →　要素を末尾から削除
push()　 →　要素を末尾に追加
top()　  →　末尾の要素を取得
size()　 →　要素数を取得
*/
 
int calc(string str){
    int x = s.top();
    s.pop();
    int y = s.top();
    s.pop();
     
    switch(str[0]){
        case '+':
            return x+y;
        case '-':
            return y-x;
        case '*':
            return x*y;
    }
    return y/x;
}
 
void judge(){
    string str;
     
    while(cin >> str){
        if(str=="+"||str=="-"||str=="*"||str=="/"){
            s.push(calc(str));
        }
        else{
            s.push(atoi(str.c_str()));　//atoiはchar型なので変換する。
        }
    }
    cout << s.top() << endl;
}
 
 
int main(){
    judge();
    return 0;
}


Compiler output:
a.cc:43:39: error: extended character 　 is not valid in an identifier
   43 |             s.push(atoi(str.c_str()));　//atoiはchar型なので変換する。
      |                                       ^
a.cc: In function 'void judge()':
a.cc:43:39: error: '\U00003000' was not declared in this scope
   43 |             s.push(atoi(str.c_str()));　//atoiはchar型なので変換する。
      |                                       ^~
Language: C++

#include<iostream>
#include<cstdlib>
#include<stack>
using namespace std;

int main() {
  // 標準ライブラリからstackを使用
  stack<int> S;
  int a, b, x;
  string s;

  while( cin >> s ) {
    if ( s[0] == '+' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a + b);
    } else if ( s[0] == '-' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a - b);
    } else if ( s[0] == '*' ) {
      b = S.top(); S.pop();
      a = S.top(); S.pop();
      S.push(a * b);
    } else {
      S.push(atoi(s.c_str()))
    }
  }

  cout << S.top() << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:30: error: expected ';' before '}' token
   26 |       S.push(atoi(s.c_str()))
      |                              ^
      |                              ;
   27 |     }
      |     ~
Language: C++

#include<bits/stdc++.h>
using namespace std;

bool isOp(char& c){
    if(c=='+' || c=='-' || c=='*') return true;
    return false;
}
int op(int f, int s, char c){
    if(c=='+') return f+s;
    else if(c=='-') return  s-f;
    else return f*s;
}
int main(){
    stack<int> st;
    char c;
    while(cin>>c)){
        if(isOp(c)){
            int f = st.top(); st.pop();
            int s = st.top(); st.pop();
            int res = op(f, s, c);
            st.push(res);
        }
        else{
            st.push(c-'0');
        }
    }
    cout<<st.top()<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:18: error: expected primary-expression before ')' token
   16 |     while(cin>>c)){
      |                  ^
Language: C++

#include <iostream>
#include <cstdlib> 
#include <string>
#include <stack>
using namespace std;

int main(){
  stack<int> S;
  int a,b;
  string s;

  while( cin >> s[0]){
    if(s[0] == '+'){
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      S.push(a + b);
    }else if(s[0] == '-'){
      a = S.top();
      S.pop();
      b = S.top();
      S.pop();
      S.push(a - b);
    }else if(s[0] == '*'){
      a = S.top();
      S.pop();
      b  = S.top();
      S.pop();
      S.push(a * b);
    }else{
      S.push(stoi(s[0]));
    }
  }

  cout << S.top() << endl;

  return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:32:18: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
   32 |       S.push(stoi(s[0]));
      |              ~~~~^~~~~~
In file included 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/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
 4164 |   stoi(const string& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |   ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
 4432 |   stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
      |        ~~~~~~~~~~~~~~~^~~~~
Language: C++

#include <iostream>
#include <studio.h>

using namespace std;
int top=0;
int const MAX=1000;
int stack[MAX];

bool isEmpty(){
    return top==0;
}
bool isFull(){
    return top>=MAX-1;
}

void push(int x){
    stack[top+1]=x;
    top++;
}

int pop(){
    top--;
    return stack[top+1];
}

int ctoi(const char c){
    if('0' <= c && c <= '9') return (c-'0');
    return -1;
}

int main()
{
    char input[100];
    int ans;
    int a,b;
    while(scanf("%s",input)!=EOF){
        switch (input[0]) {
            case '+':
                b = pop();
                a = pop();
                ans = a + b;
                push(ans);
                break;
            case '-':
                b = pop();
                a = pop();
                ans = a - b;
                push(ans);
                break;
            case '*':
                b = pop();
                a = pop();
                ans = a * b;
                push(ans);
                break;
            case '/':
                b = pop();
                a = pop();
                ans = a / b;
                push(ans);
                break;
            default:
                push(ctoi(input[0]));
        }
    }
    cout<<ans<<endl;
}


Compiler output:
a.cc:2:10: fatal error: studio.h: No such file or directory
    2 | #include <studio.h>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

// スタック
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<limits.h>

// スタック関連の定義
const int Max_Stack = 1000;
int stack_count = 0;
int ary_stack[Max_Stack];

void create_stack(void);
int push(int element);
int pop(void);

int main(void)
{
    char str[10];
    int i = 0, ch, operand_1, operand_2;
    int result;

    // スタックを作成
    create_stack();

    while( ( ch = getchar() ) != '\n' )
    {

        if( '0' <= ch && ch <= '9' )
        {
            str[i++] = ch;
        }
        else if( ch == '+' || ch == '-' || ch == '*' )
        {
            operand_1 = pop();
            operand_2 = pop();

            if( ch == '+' )
            {
                result = operand_2 + operand_1;
            }
            else if( ch == '-' )
            {
                result = operand_2 - operand_1;
            }
            if( ch == '*' )
            {
                result = operand_2 * operand_1;
            }

            // 演算結果をpushしておく
            push(result);
        }
        else if( str[0] != '\0' )
        {
            str[i] = '\0';

            // 数値をプッシュする
            push(atoi(&str[0]));

            // 初期化をする
            i = 0;
            str[0] = '\0';
        }
    }

    printf("%d\n", result);

    return 0;

}

// スタックを作成する関数
void create_stack(void)
{
    int i;

    for(i = 0; i < Max_Stack; i++)
    {
        // スタックの初期化
        ary_stack[i] = 0;
    }

    return;
}

// スタックへプッシュする関数
int push(int element)
{

    if( stack_count >= Max_Stack - 1 )
    {
        // サイズオーバー
        return -1;
    }

    // スタックに追加する
    ary_stack[++stack_count] = element;

    return 0;
}

// スタックからポップする関数
int pop(void)
{
    int ret = 0;

    if( stack_count =< 0 )
    {
        // スタックが空の時
        ret = INT_MIN;
    }
    else
    {
        ret = ary_stack[stack_count--];
    }

    return ret;
}



Compiler output:
a.cc: In function 'int pop()':
a.cc:108:22: error: expected primary-expression before '<' token
  108 |     if( stack_count =< 0 )
      |                      ^
Language: C++

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

class Stack
{
public:
	void push(int x)
	{
		++myTop;
		myData[myTop] = x;
	}
	void pop()
	{
		--myTop;
	}
	int top()
	{
		int nTemp = myData[myTop];
		return nTemp;
	}
private:
	int myTop = 0;
	int myData[1000] = { 0 };
};


int main()
{
	char chIn[100] = { '\0' };
	Stack staIn;
	int nTemp = 0;
	int na = 0, nb = 0;

	while (scanf_s("%s", chIn, 100))
	{
		if (chIn[0] - '0' <= 9 && chIn[0] - '0' >= 0)
		{
			nTemp = atoi(chIn);
			staIn.push(nTemp);
		}
		else
		{
			nb = staIn.top();
			staIn.pop();
			na = staIn.top();
			staIn.pop();
			switch (chIn[0])
			{
			case '-':
				staIn.push(na - nb);
				break;
			case '+':
				staIn.push(na + nb);
				break;
			case '*':
				staIn.push(na * nb);
				break;
			}
		}
	}
	int nout = staIn.top();
	printf("%d\n", staIn.top());
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:35:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   35 |         while (scanf_s("%s", chIn, 100))
      |                ^~~~~~~
      |                scanf
Language: C++

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int myTop = 0;
int myData[1000] = { 0 };
void push(int x)
{
	++myTop;
	myData[myTop] = x;
}
void pop()
{
	--myTop;
}
int top()
{
	int nTemp = myData[myTop];
	return nTemp;
}

int main()
{
	char chIn[100] = { '\0' };
	int nTemp = 0;
	int na = 0, nb = 0;

	while (scanf_s("%s", chIn, 100))
	{
		if (chIn[0] - '0' <= 9 && chIn[0] - '0' >= 0)
		{
			nTemp = atoi(chIn);
			push(nTemp);
		}
		else
		{
			nb = top();
			pop();
			na = top();
			pop();
			switch (chIn[0])
			{
			case '-':
				push(na - nb);
				break;
			case '+':
				push(na + nb);
				break;
			case '*':
				push(na * nb);
				break;
			}
		}
	}
	printf("%d\n", top());
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   28 |         while (scanf_s("%s", chIn, 100))
      |                ^~~~~~~
      |                scanf
Language: C++


#include <algorithm>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

class Stack {
public:
	Stack(int n) : s_(n), top_(0){};

	bool isEmpty() { return top_ == 0; }
	bool isFull() { return top_ == s_.size(); }

	void push(int x) {
		if (isFull()) {
			return;
		}
		top_++;
		s_[top_] = x;
	}

	int pop() {
		if (isEmpty()) { return -1; }
		top_--;
		return s_[top_ + 1];
	}

private:
	vector<int> s_;
	size_t top_;
};


int main() {
	char s[1000];

	Stack stack(110);

	while (scanf_s("%s", s, 1000) != EOF) {
		if (s[0] == '+') {
			// 加算
			int rhs = stack.pop();
			int lhs = stack.pop();
			int t = lhs + rhs;
			stack.push(t);
		}
		else if (s[0] == '-') {
			// 減算
			int rhs = stack.pop();
			int lhs = stack.pop();
			int t = lhs - rhs;
			stack.push(t);
		}
		else if (s[0] == '*') {
			// 乗算
			int rhs = stack.pop();
			int lhs = stack.pop();
			int t = lhs * rhs;
			stack.push(t);
		}
		else {
			// スタックに値を追加
			stack.push(atoi(s));
		}
	}

	printf("%d\n", stack.pop());
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:16: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   42 |         while (scanf_s("%s", s, 1000) != EOF) {
      |                ^~~~~~~
      |                scanf
Language: C++

/*
 * ALDS1_3_A.cpp
 *
 *  Created on: Apr 25, 2018
 *      Author: 13743
 */

#include<cstdio>
#include<stack>
#include<cstdlib>

using namespace std;

int main() {
	stack<int> st;
	char s[100];
	while(scanf("%s", s) != EOF) {
		if(s[0] == '+') {
			int a = st.pop();
			int b = st.pop();
			st.push(a+b);
		}
		else if(s[0] == '-') {
			int a = st.pop();
			int b = st.pop();
			st.push(a-b);
		}
		else if(s[0] == '*') {
			int a = st.pop();
			int b = st.pop();
			st.push(a*b);
		}
		else {
			st.push(atoi(s));
		}
	}
	printf("%d\n", st.pop());
}





Compiler output:
a.cc: In function 'int main()':
a.cc:19:39: error: void value not ignored as it ought to be
   19 |                         int a = st.pop();
      |                                 ~~~~~~^~
a.cc:20:39: error: void value not ignored as it ought to be
   20 |                         int b = st.pop();
      |                                 ~~~~~~^~
a.cc:24:39: error: void value not ignored as it ought to be
   24 |                         int a = st.pop();
      |                                 ~~~~~~^~
a.cc:25:39: error: void value not ignored as it ought to be
   25 |                         int b = st.pop();
      |                                 ~~~~~~^~
a.cc:29:39: error: void value not ignored as it ought to be
   29 |                         int a = st.pop();
      |                                 ~~~~~~^~
a.cc:30:39: error: void value not ignored as it ought to be
   30 |                         int b = st.pop();
      |                                 ~~~~~~^~
a.cc:37:30: error: invalid use of void expression
   37 |         printf("%d\n", st.pop());
      |                        ~~~~~~^~