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

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

int main() {
  int a,b;
  char s;
  cin >> a >> s >> b

  int answer;
  if( s == '+') {
   answer = a + b;
  } else {
   answer =  a - b;
  }
  cout << answer << endl;


}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #inclde; did you mean #include?
    1 | #inclde <bits/stdc++.h>
      |  ^~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> a >> s >> b
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | #inclde <bits/stdc++.h>
a.cc:11:4: error: 'answer' was not declared in this scope
   11 |    answer = a + b;
      |    ^~~~~~
a.cc:13:4: error: 'answer' was not declared in this scope
   13 |    answer =  a - b;
      |    ^~~~~~
a.cc:15:3: error: 'cout' was not declared in this scope
   15 |   cout << answer << endl;
      |   ^~~~
a.cc:15:3: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:15:11: error: 'answer' was not declared in this scope
   15 |   cout << answer << endl;
      |           ^~~~~~
a.cc:15:21: error: 'endl' was not declared in this scope
   15 |   cout << answer << endl;
      |                     ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | #inclde <bits/stdc++.h>
Language: C++

using namespace std ;
int main () {

int x,y,z;
    char ope;
   cin>>x;
    cin>>ope;
     cin>>y;

    switch(ope)
    {
    case '+':
        z=x+y;
        cout<<z;
        break;

    case '-':
        z=x-y;
        cout<<z;
        break;
    }
 return 0 ;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:6:4: error: 'cin' was not declared in this scope
    6 |    cin>>x;
      |    ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std ;
a.cc:14:9: error: 'cout' was not declared in this scope
   14 |         cout<<z;
      |         ^~~~
a.cc:14:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: Java

/*
ID: andy.sc1
LANG: JAVA
TASK: addsub
*/

// Imports
import java.util.*;
import java.io.*;

public class addsub {

    /**
     * @param args the command line arguments
     * @throws IOException, FileNotFoundException 
     */
    public static void main(String[] args) throws IOException, FileNotFoundException {
        
        // TODO UNCOMMENT WHEN ALGORITHM CORRECT
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        
        // TODO code application logic here
        StringTokenizer st = new StringTokenizer(f.readLine());
        long i = Long.parseLong(st.nextToken());
        char ch = st.nextToken().charAt(0);
        long j = Long.parseLong(st.nextToken());
        
        if(ch == '+') {
            System.out.println(i + j);
        }
        else {
            System.out.println(i - j);
        }
    }

}


Compiler output:
Main.java:11: error: class addsub is public, should be declared in a file named addsub.java
public class addsub {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B;
  char s;
  cin >> A >> s >> B;
  if(s == "+"){
  A += B;
  }
  if(s == "-"){
  A -= B;
  }
  cout << A << endl;;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(s == "+"){
      |      ~~^~~~~~
a.cc:11:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |   if(s == "-"){
      |      ~~^~~~~~
Language: C++

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

int main() {
  int A, B;
  string s;
  cin >> A >> op >> B;
  
  if (op == "+") {
    cout << A + B << endl;
  }else{
    cout << A - B << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:15: error: 'op' was not declared in this scope
    7 |   cin >> A >> op >> B;
      |               ^~
Language: C

#include<stdio.h>
int main(){
    long long A,B,SUM;
    char op;
    scanf("%lld %c %lld",&A,&op,&B);
    if(op == '+'){
        SUM = A + B;
    }else if(op == '-'){
        SUM = A - B;
    }else if(op == '*'){
        SUM = A * B;
    }else if(op == '/'){
        if(B == 0){
            printf("B not is zero");
            return0;
        }
        SUM = A / B;
    }
    printf("%lld",SUM);
    return 0;
}


Compiler output:
main.c: In function 'main':
main.c:15:13: error: 'return0' undeclared (first use in this function)
   15 |             return0;
      |             ^~~~~~~
main.c:15:13: note: each undeclared identifier is reported only once for each function it appears in
Language: C++

#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;


#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;


void Main(){
   int a, b;
  string op;
   cin >> a >>　op >> b;
   
  if(op=="+")
  cout << a+b  << endl;
  else
  cout << a-b << endl;
 return;
 }
  
int main(){
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 cout << fixed << setprecision(15);
 Main();
 return 0;
 }


Compiler output:
a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
    2 | #include<boost/multi_array.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>
using namespace std;
namespace adaptor = boost::adaptors;


#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
typedef long long ll;


void Main(){
   int a, b;
  strings op;
   cin >> a >>　op >> b;
   
  if(op=="+")
  cout << a+b  << endl;
  else
  cout << a-b << endl;
 return;
 }
  
int main(){
 cin.tie(nullptr);
 ios_base::sync_with_stdio(false);
 cout << fixed << setprecision(15);
 Main();
 return 0;
 }

Compiler output:
a.cc:2:9: fatal error: boost/multi_array.hpp: No such file or directory
    2 | #include<boost/multi_array.hpp>
      |         ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream >

using namespace std ;
int main (){

int x;
int z ;
char o;
cin  >>x>>o>>z;
if (o=='+'){
    cout << x+z;
}
else if (o=='-'){
    cout << x-z;
}














return 0;
}


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


int main() {
  
  int a,b;
  string op;
  cin >> a >> op >> b;

    if (op == "+") {
       cout << a + b << endl;
    } else if(op == "-") {
     
      cout << a - b << endl;
    } 
     return 0; 


}


Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string op;
      |   ^~~~~~
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> a >> op >> b;
      |   ^~~
a.cc:6:15: error: 'op' was not declared in this scope
    6 |   cin >> a >> op >> b;
      |               ^~
a.cc:9:8: error: 'cout' was not declared in this scope
    9 |        cout << a + b << endl;
      |        ^~~~
a.cc:9:25: error: 'endl' was not declared in this scope
    9 |        cout << a + b << endl;
      |                         ^~~~
a.cc:12:7: error: 'cout' was not declared in this scope
   12 |       cout << a - b << endl;
      |       ^~~~
a.cc:12:24: error: 'endl' was not declared in this scope
   12 |       cout << a - b << endl;
      |                        ^~~~
Language: C++

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

int main() {
  int a, c;
  char b;
  cin >> a >> b >> c;
  if ( b == '+' ) {
    a += c
  }

  else {
    a -=c
  }
  cout << a << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:11: error: expected ';' before '}' token
    9 |     a += c
      |           ^
      |           ;
   10 |   }
      |   ~        
a.cc:13:10: error: expected ';' before '}' token
   13 |     a -=c
      |          ^
      |          ;
   14 |   }
      |   ~
Language: C++

(defun solve (a b c)
	(if (equal b '-)
    	(- a b)
        (+ a b)))
(print (solve (read) (read) (read))

Compiler output:
a.cc:2:22: warning: missing terminating ' character
    2 |         (if (equal b '-)
      |                      ^
a.cc:2:22: error: missing terminating ' character
    2 |         (if (equal b '-)
      |                      ^~~
a.cc:1:7: error: expected ')' before 'solve'
    1 | (defun solve (a b c)
      | ~     ^~~~~~
      |       )
Language: C++

#include <iostream>
#include <vector>
#include<algorithm>
#include<math.h>
#include<iomanip>
#include <set>
#define ff(i,m,n) for(int i=m;i<n;i++)
#define i64 int64_t
using namespace std;


int main() {
	int a, b;
	cin >>a 
	char c;
	cin >> c >> b;
	if (c == '+') {
		cout << a + b << endl;
			return 0;
	}
	cout << a - b << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:16: error: expected ';' before 'char'
   14 |         cin >>a
      |                ^
      |                ;
   15 |         char c;
      |         ~~~~    
a.cc:16:16: error: 'c' was not declared in this scope
   16 |         cin >> c >> b;
      |                ^
Language: C++

#include<stdio.h>
#include<string.h>
int main(){
	char a[1];
	int b[2];
	int c;
	scanf("%d %s %d",&b[0],&a[0],&b[1]);
	if(a =='+'){
		c=b[0]+b[1];
		printf("%d",c);
	}
	else if(a =='-'){
		c=b[0]-b[1];
		printf("%d",c);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if(a =='+'){
      |            ~~^~~~~
a.cc:12:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |         else if(a =='-'){
      |                 ~~^~~~~
Language: C++

#include<stdio.h>
#include<string.h>
int main(){
	char a[1];
	int b[2];
	int c;
	scanf("%d %s %d",&b[0],&a[0],&b[1]);
	if(a =='+'){
		c=b[0]+b[1];
	}
	else if(a =='-'){
		c=b[0]-b[1];
	}
	printf("%d",c);
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:14: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |         if(a =='+'){
      |            ~~^~~~~
a.cc:11:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   11 |         else if(a =='-'){
      |                 ~~^~~~~
Language: C++

ts/stdc++.h>
using namespace std;

int main() {
  int A, B;
  char op;
  cin >> A >> op >> B;
  
  
 if(op == '+'){
  cout<<A + B<<endl;
  }
  
 if(op == '-'){
  cout<<A - B<<endl;
  }
}

Compiler output:
a.cc:1:1: error: 'ts' does not name a type
    1 | ts/stdc++.h>
      | ^~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
    7 |   cin >> A >> op >> B;
      |   ^~~
a.cc:11:3: error: 'cout' was not declared in this scope
   11 |   cout<<A + B<<endl;
      |   ^~~~
a.cc:11:16: error: 'endl' was not declared in this scope
   11 |   cout<<A + B<<endl;
      |                ^~~~
a.cc:15:3: error: 'cout' was not declared in this scope
   15 |   cout<<A - B<<endl;
      |   ^~~~
a.cc:15:16: error: 'endl' was not declared in this scope
   15 |   cout<<A - B<<endl;
      |                ^~~~
Language: C++

#include<iostream>
using namespace std;
 
int main(){
  int A, B;
  char op;
  cin >> A >> op >> B;
  if (op=='+') cout << A + B << endl;
  else cout << A - B << endl;
  
  return 0;

Compiler output:
a.cc: In function 'int main()':
a.cc:11:12: error: expected '}' at end of input
   11 |   return 0;
      |            ^
a.cc:4:11: note: to match this '{'
    4 | int main(){
      |           ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int A, B;
  ch op;
  cin >> A >> op >> B;
  if (op=='+') cout << A + B;
  else cout << A - B;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:3: error: 'ch' was not declared in this scope
    6 |   ch op;
      |   ^~
a.cc:7:15: error: 'op' was not declared in this scope
    7 |   cin >> A >> op >> B;
      |               ^~
Language: Java


public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[scanner.nextInt()]++;
        }
        if (N % 2 == 1 && A[0] != 1) {
            System.out.println(0);
            return;
        }
        for (int i = Math.abs(N % 2 - 1); i < N; i += 2) {
            if (i == 0) continue;
            if (A[i] != 2) {
                System.out.println(0);
                return;
            }
        }
        int result = 1;
        for (int i = 0; i < N / 2; i++) {
            result *= 2;
            result %= (Math.pow(10, 9) + 7);
        }

        System.out.println(result);
    }

}

Compiler output:
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:5: error: cannot find symbol
        Scanner scanner = new Scanner(System.in);
                              ^
  symbol:   class Scanner
  location: class Main
2 errors
Language: C++

#include <iostream>
int main(){int a,b,char c;std::cin>>a>>c>>b;std::cout<<(c=='+'?a+b:a-b);}

Compiler output:
a.cc: In function 'int main()':
a.cc:2:20: error: expected unqualified-id before 'char'
    2 | int main(){int a,b,char c;std::cin>>a>>c>>b;std::cout<<(c=='+'?a+b:a-b);}
      |                    ^~~~
a.cc:2:40: error: 'c' was not declared in this scope
    2 | int main(){int a,b,char c;std::cin>>a>>c>>b;std::cout<<(c=='+'?a+b:a-b);}
      |                                        ^
Language: C++

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

int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == ‘+’) cout << a + b;
  else cout << a - b;
  cout << ‘\n’;
}


Compiler output:
a.cc:8:13: error: extended character ‘ is not valid in an identifier
    8 |   if (op == ‘+’) cout << a + b;
      |             ^
a.cc:8:15: error: extended character ’ is not valid in an identifier
    8 |   if (op == ‘+’) cout << a + b;
      |               ^
a.cc:10:11: error: extended character ‘ is not valid in an identifier
   10 |   cout << ‘\n’;
      |           ^
a.cc:10:12: error: stray '\' in program
   10 |   cout << ‘\n’;
      |            ^
a.cc:10:13: error: extended character ’ is not valid in an identifier
   10 |   cout << ‘\n’;
      |             ^
a.cc: In function 'int main()':
a.cc:8:13: error: '\U00002018' was not declared in this scope
    8 |   if (op == ‘+’) cout << a + b;
      |             ^
a.cc:8:15: error: '\U00002019' was not declared in this scope
    8 |   if (op == ‘+’) cout << a + b;
      |               ^
a.cc:10:11: error: '\U00002018' was not declared in this scope
   10 |   cout << ‘\n’;
      |           ^
Language: C++

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

int main() {
  int a, b;
  char op;
  cin >> a >> op >> b;
  if (op == ‘+’) cout << a + b;
  else cout << a - b;
  cout << ‘\n’;
}

Compiler output:
a.cc:8:13: error: extended character ‘ is not valid in an identifier
    8 |   if (op == ‘+’) cout << a + b;
      |             ^
a.cc:8:15: error: extended character ’ is not valid in an identifier
    8 |   if (op == ‘+’) cout << a + b;
      |               ^
a.cc:10:11: error: extended character ‘ is not valid in an identifier
   10 |   cout << ‘\n’;
      |           ^
a.cc:10:12: error: stray '\' in program
   10 |   cout << ‘\n’;
      |            ^
a.cc:10:13: error: extended character ’ is not valid in an identifier
   10 |   cout << ‘\n’;
      |             ^
a.cc:2:17: error: 'ste' is not a namespace-name
    2 | using namespace ste;
      |                 ^~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    7 |   cin >> a >> op >> b;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:8:13: error: '\U00002018' was not declared in this scope
    8 |   if (op == ‘+’) cout << a + b;
      |             ^
a.cc:8:15: error: '\U00002019' was not declared in this scope
    8 |   if (op == ‘+’) cout << a + b;
      |               ^
a.cc:8:18: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    8 |   if (op == ‘+’) cout << a + b;
      |                  ^~~~
      |                  std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:9:8: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    9 |   else cout << a - b;
      |        ^~~~
      |        std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   10 |   cout << ‘\n’;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
a.cc:10:11: error: '\U00002018' was not declared in this scope
   10 |   cout << ‘\n’;
      |           ^
Language: C++

#include<stdio.h>
int main(void)
{
  int s;
  cin >>s;
  cout << s;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'cin' was not declared in this scope
    5 |   cin >>s;
      |   ^~~
a.cc:6:3: error: 'cout' was not declared in this scope
    6 |   cout << s;
      |   ^~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;
 
  if (op == "+"){
    cout << A + B <<endl;
  }
 
  else (op == "-"){
    cout << A - B << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before '{' token
   13 |   else (op == "-"){
      |                   ^
      |                   ;
a.cc:13:12: warning: ignoring return value of 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
   13 |   else (op == "-"){
      |        ~~~~^~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3772:5: note: declared here
 3772 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B;
  string op;
  cin >> A >> op >> B;
 
  if (op == "+"){
    cout << A + B <<endl;
  }

  else (op == "-"){
    cout << A - B << endl;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:19: error: expected ';' before '{' token
   13 |   else (op == "-"){
      |                   ^
      |                   ;
a.cc:13:12: warning: ignoring return value of 'bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
   13 |   else (op == "-"){
      |        ~~~~^~~~~~~
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3772:5: note: declared here
 3772 |     operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
Language: C++

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

int main() {
	int a, b,ans;
	char op;
	cin >> a >> op >> b;

	if (op == '+')
	{
		ans = a + b;
	}
	else if (op == '-')
	{
		ans = a - b;
	}

	cout << ans << endl;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
    7 |         cin >> a >> op >> b;
      |         ^~~
a.cc:18:9: error: 'cout' was not declared in this scope
   18 |         cout << ans << endl;
      |         ^~~~
a.cc:18:24: error: 'endl' was not declared in this scope
   18 |         cout << ans << endl;
      |                        ^~~~
Language: C++

#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
  int a,b;
  string c;
  cin>>a>>c>>b;
  (c='+')? cout<<a+b:cout<<a-b;
  
 
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:5: error: could not convert 'c.std::__cxx11::basic_string<char>::operator=(43)' from 'std::__cxx11::basic_string<char>' to 'bool'
   11 |   (c='+')? cout<<a+b:cout<<a-b;
      |   ~~^~~~~
      |     |
      |     std::__cxx11::basic_string<char>
Language: C++

#include<iostream>
using namespace std;
int main(){
  int a,b;
  char c;
  cin >> a >> c >> b;
  if (c=="+"){
    return a+b;
  }else{
    return a-b;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:7:8: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    7 |   if (c=="+"){
      |       ~^~~~~
Language: C++

#include<stdio.h>
int main()
{
    long long int A,B;
    char C;

    scanf("%lld %c %lld", &A , &C, &B);

    if(C=='+')
        printf("%d\n",A+B);
    else if(C=='-')
        printf("%d\n",A-B);
        else
            return;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:13: error: return-statement with no value, in function returning 'int' [-fpermissive]
   14 |             return;
      |             ^~~~~~
Language: C++

#include<iosteram>
using namespace std;
int main(){
  int a,b;
  char c;
  cin >> a >> c >> b;
  if(c == '-') cout << a-b;
  else cout << a+b;
}

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

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll A, B;
    char op;
    cin >> A >> cp >> B;
    if(op == '+') {
        cout << A + B << endl;
        return 0;
    } else {
        cout << A - B << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'cp' was not declared in this scope; did you mean 'op'?
   39 |     cin >> A >> cp >> B;
      |                 ^~
      |                 op
Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

int main() {
    ll A, B;
    char op;
    cin >> A >> cp >> B;
    if(op == '+') {
        cout << A + B << endl;
        reutrn 0;
    } else {
        cout << A - B << endl;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:39:17: error: 'cp' was not declared in this scope; did you mean 'op'?
   39 |     cin >> A >> cp >> B;
      |                 ^~
      |                 op
a.cc:42:9: error: 'reutrn' was not declared in this scope
   42 |         reutrn 0;
      |         ^~~~~~
Language: C++

#include<iostream>
using namespace std;
int main(){
  int a, b;
  char op;
  cin >> a >> op >> b;

  int ans;
  if(op == '+'
    ans = a+b;
  else
     ans = a-b;

  cout << ans;
     
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:15: error: expected ';' before 'ans'
    9 |   if(op == '+'
      |               ^
      |               ;
   10 |     ans = a+b;
      |     ~~~        
a.cc:11:3: error: expected primary-expression before 'else'
   11 |   else
      |   ^~~~
a.cc:10:15: error: expected ')' before 'else'
   10 |     ans = a+b;
      |               ^
      |               )
   11 |   else
      |   ~~~~         
a.cc:9:5: note: to match this '('
    9 |   if(op == '+'
      |     ^
Language: C

#include<stdio.h>
int main()
{
	long long int a, b;
	char ch;
	
	scanf("%lld", &a);
	scanf("%c", &ch);
	scanf("%lld", &b);
	
	if (ch == '+') {
		printf("%lld\n", a + b);
	}
	else if  {
		printf("%lld\n", a - b);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:18: error: expected '(' before '{' token
   14 |         else if  {
      |                  ^
      |                  (
Language: C

#include<stdio.h>
int main()
{
	int a, b;
	char s;
	
	scanf("%d", &a);
	scanf("%c", &s);
	scanf("%d", &b);
	
	if (s == +) {
		printf("%d\n", a + b);
	}
	if (s == -) {
		printf("%d\n", a - b);
	}
	
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:11:19: error: expected expression before ')' token
   11 |         if (s == +) {
      |                   ^
main.c:14:19: error: expected expression before ')' token
   14 |         if (s == -) {
      |                   ^
Language: Java

import java.util.*;

public class Main {
	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
        int num1 = Integer.parseInt(sc.next());
        String op = sc.next();
        int num1 = Integer.parseInt(sc.next());
        if ("+".equals(op)) {
        	System.out.println(num1 + num2);
        } else {
            System.out.println(num1 - num2);
        }
    }
}

Compiler output:
Main.java:8: error: variable num1 is already defined in method main(String[])
        int num1 = Integer.parseInt(sc.next());
            ^
Main.java:10: error: cannot find symbol
        	System.out.println(num1 + num2);
        	                          ^
  symbol:   variable num2
  location: class Main
Main.java:12: error: cannot find symbol
            System.out.println(num1 - num2);
                                      ^
  symbol:   variable num2
  location: class Main
3 errors
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
int A, B;
cin>>A>>B;
char op;
cin>>op;
if(op = '+'){
    cout<<A+B<<endl;
    else{
        cout<<A-B<<endl;
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:5: error: expected '}' before 'else'
   10 |     else{
      |     ^~~~
a.cc:8:13: note: to match this '{'
    8 | if(op = '+'){
      |             ^
Language: C++

# include<bits/stdc++.h>
using namespace std;
int main (){
int a,b;
char c;
cin>>a>>c>>b;
if(c=='+')
cout<<a+b;
else {
    cout<<a-b;


Compiler output:
a.cc: In function 'int main()':
a.cc:10:15: error: expected '}' at end of input
   10 |     cout<<a-b;
      |               ^
a.cc:9:6: note: to match this '{'
    9 | else {
      |      ^
a.cc:10:15: error: expected '}' at end of input
   10 |     cout<<a-b;
      |               ^
a.cc:3:12: note: to match this '{'
    3 | int main (){
      |            ^
Language: C++

#include<iostream>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    string S;
    int a, b;
    cin >> a >> S >> b;
    if(S='+'){
        cout << a+b << endl;
    }else{
        cout << a-b << endl;
    }
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:10:9: error: could not convert 'S.std::__cxx11::basic_string<char>::operator=(43)' from 'std::__cxx11::basic_string<char>' to 'bool'
   10 |     if(S='+'){
      |        ~^~~~
      |         |
      |         std::__cxx11::basic_string<char>
Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int A, B; string op; cin >> A >> op >> B;
  int result = string=="+" ? A+B : A-B;
  cout << result << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:22: error: expected primary-expression before '==' token
   18 |   int result = string=="+" ? A+B : A-B;
      |                      ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;

int main() {
    int A, B;
    char op;
    cin >> A >> op >> b;
    if (op == '+'){
        cout << A + B << endl;
    }
    else {
        cout << A - B << endl;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:10:23: error: 'b' was not declared in this scope
   10 |     cin >> A >> op >> b;
      |                       ^
Language: C++

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

int main() {
  int A, B;
  char op;
  cin >> A >> op >>B ;
  if(op == '+')
  cout << A + B ;
  if(op == '-')
  cout << A - B
}


Compiler output:
a.cc: In function 'int main()':
a.cc:11:16: error: expected ';' before '}' token
   11 |   cout << A - B
      |                ^
      |                ;
   12 | }
      | ~
Language: C++

using namespace std;

int main(){
  int a, b;
  char c;
  cin >> a >> c >> b;
  if(c == 'char') cout << a + b << endl;
  else cout << a - b << endl;
  return 0;
}

Compiler output:
a.cc:7:11: warning: multi-character character constant [-Wmultichar]
    7 |   if(c == 'char') cout << a + b << endl;
      |           ^~~~~~
a.cc: In function 'int main()':
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> a >> c >> b;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:7:19: error: 'cout' was not declared in this scope
    7 |   if(c == 'char') cout << a + b << endl;
      |                   ^~~~
a.cc:7:19: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:36: error: 'endl' was not declared in this scope
    7 |   if(c == 'char') cout << a + b << endl;
      |                                    ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:8:8: error: 'cout' was not declared in this scope
    8 |   else cout << a - b << endl;
      |        ^~~~
a.cc:8:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:25: error: 'endl' was not declared in this scope
    8 |   else cout << a - b << endl;
      |                         ^~~~
a.cc:8:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

using namespace std;

int main(){
  int a, b;
  string c;
  cin >> a >> c >> b;
  if(c == "+") cout << a + b << endl;
  else cout << a - b << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string c;
      |   ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> a >> c >> b;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:15: error: 'c' was not declared in this scope
    6 |   cin >> a >> c >> b;
      |               ^
a.cc:7:16: error: 'cout' was not declared in this scope
    7 |   if(c == "+") cout << a + b << endl;
      |                ^~~~
a.cc:7:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:33: error: 'endl' was not declared in this scope
    7 |   if(c == "+") cout << a + b << endl;
      |                                 ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:8:8: error: 'cout' was not declared in this scope
    8 |   else cout << a - b << endl;
      |        ^~~~
a.cc:8:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:25: error: 'endl' was not declared in this scope
    8 |   else cout << a - b << endl;
      |                         ^~~~
a.cc:8:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

using namespace std;

int main(){
  int a, b;
  string c;
  cin >> a >> c >> b;
  if(c == '+') cout << a + b << endl;
  else cout << a - b << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:3: error: 'string' was not declared in this scope
    5 |   string c;
      |   ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
  +++ |+#include <string>
    1 | using namespace std;
a.cc:6:3: error: 'cin' was not declared in this scope
    6 |   cin >> a >> c >> b;
      |   ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:6:15: error: 'c' was not declared in this scope
    6 |   cin >> a >> c >> b;
      |               ^
a.cc:7:16: error: 'cout' was not declared in this scope
    7 |   if(c == '+') cout << a + b << endl;
      |                ^~~~
a.cc:7:16: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:7:33: error: 'endl' was not declared in this scope
    7 |   if(c == '+') cout << a + b << endl;
      |                                 ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
  +++ |+#include <ostream>
    1 | using namespace std;
a.cc:8:8: error: 'cout' was not declared in this scope
    8 |   else cout << a - b << endl;
      |        ^~~~
a.cc:8:8: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:8:25: error: 'endl' was not declared in this scope
    8 |   else cout << a - b << endl;
      |                         ^~~~
a.cc:8:25: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include <bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  char op:
  cin >> A >> op >> B;
  if (op == '+'){
    cout << A+B;
  } else {
    cout << A-B;
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:5:10: error: found ':' in nested-name-specifier, expected '::'
    5 |   char op:
      |          ^
      |          ::
a.cc:5:8: error: 'op' has not been declared
    5 |   char op:
      |        ^~
a.cc:6:7: error: qualified-id in declaration before '>>' token
    6 |   cin >> A >> op >> B;
      |       ^~
a.cc:7:7: error: 'op' was not declared in this scope
    7 |   if (op == '+'){
      |       ^~
Language: C++

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

int main(){
int A, B;
char op;
cin >> A >> op >> B;
if(op == +){
cout << A + B << endl;
}
else if(op == -){
cout << A - B << endl;
}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:11: error: expected primary-expression before ')' token
    8 | if(op == +){
      |           ^
a.cc:11:16: error: expected primary-expression before ')' token
   11 | else if(op == -){
      |                ^
Language: C++

#include<iostream>
using namespace std;

int main(){
  int a,b;
  char p;
  cin>>a>>p>>b;
  if(p=="+")
    cout<<a+b;
  else
    cout<<a-b;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:7: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
    8 |   if(p=="+")
      |      ~^~~~~
Language: C++

#include<bits/stc++.h>
using namespace std;
#define int long long
#define sz(x) (int)(x.size())

signed main() {
    int a, op, b;
    cin >> a >> op >> b;
    if (op == '+') cout << a + b << "\n";
    else cout << a - b << "\n";
}


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

#include <bits/stdc++.h>
int main(){
  int a,b;
  string op;
  cin>>a>>op>>b;
  cout<<op=="+"?a+b:a-b;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:4:3: error: 'string' was not declared in this scope
    4 |   string op;
      |   ^~~~~~
a.cc:4:3: note: suggested alternatives:
In file included from /usr/include/c++/14/string:41,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/stringfwd.h:77:33: note:   'std::string'
   77 |   typedef basic_string<char>    string;
      |                                 ^~~~~~
/usr/include/c++/14/string:76:11: note:   'std::pmr::string'
   76 |     using string    = basic_string<char>;
      |           ^~~~~~
a.cc:5:3: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
    5 |   cin>>a>>op>>b;
      |   ^~~
      |   std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:5:11: error: 'op' was not declared in this scope
    5 |   cin>>a>>op>>b;
      |           ^~
a.cc:6:3: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
    6 |   cout<<op=="+"?a+b:a-b;
      |   ^~~~
      |   std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~
Language: C

#include <stdio.h>
 
int main(void)
{
  int num1;
  char num2;
  int num3;
  
  scanf_s("%d %c %d",num1,num2,num3);
  
  if(num2 == '+'){
    printf("%d\n",num1 + num3);
  }
  else if(num2 == '-'){
    printf("%d\n",num1 - num3);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:3: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
    9 |   scanf_s("%d %c %d",num1,num2,num3);
      |   ^~~~~~~
      |   scanf
Language: C++

#include<iostream>
    using namespace std;
    int main()
    {
      int a;
      char op;
      int b;

      std::cin >> a;
      std::cin >> op;
      std::cin >> b;
      if ( op == "+") {
        std::cout << a+b << '\n';
        /* code */
      }

      else {
        std::cout << a-b << '\n';
      }
        return 0;
      }


Compiler output:
a.cc: In function 'int main()':
a.cc:12:15: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   12 |       if ( op == "+") {
      |            ~~~^~~~~~
Language: C

int main(void)
{
	int num1;
	char str[10];
	char str1[10];
	char str2[10];
	int num3;
 
	fgets(str,10,stdin);
	sscanf(str,"%d", &num1);
 
	fgets(str,10,stdin);
 
	fgets(str2, 10, stdin);
	sscanf(str2,"%d", &num3);
 
	if (str1 == '+') {
		printf("%d\n", num1+num3);
	}
	else if (str1 == '-') {
		printf("%d\n", num1-num3);
	}
 
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration]
    9 |         fgets(str,10,stdin);
      |         ^~~~~
main.c:9:22: error: 'stdin' undeclared (first use in this function)
    9 |         fgets(str,10,stdin);
      |                      ^~~~~
main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:9:22: note: each undeclared identifier is reported only once for each function it appears in
    9 |         fgets(str,10,stdin);
      |                      ^~~~~
main.c:10:9: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
   10 |         sscanf(str,"%d", &num1);
      |         ^~~~~~
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:10:9: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:17:18: warning: comparison between pointer and integer
   17 |         if (str1 == '+') {
      |                  ^~
main.c:18:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |                 printf("%d\n", num1+num3);
      |                 ^~~~~~
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:23: warning: comparison between pointer and integer
   20 |         else if (str1 == '-') {
      |                       ^~
main.c:21:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   21 |                 printf("%d\n", num1-num3);
      |                 ^~~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

int main(void)
{
	int num1;
	char str[10];
	char str1[10];
	char str2[10];
	int num3;

	fgets(str,10,stdin);
	sscanf(str,"%d", &num1);

	fgets(str,10,stdin);

	fgets(str2, 10, stdin);
	sscanf(str2,"%d", &num3);

	if (str1 == '+') {
		printf("%d\n", num1+num3);
	}
	else if (str1 == '-') {
		printf("%d\n", num1-num3);
	}

	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:9:9: error: implicit declaration of function 'fgets' [-Wimplicit-function-declaration]
    9 |         fgets(str,10,stdin);
      |         ^~~~~
main.c:9:22: error: 'stdin' undeclared (first use in this function)
    9 |         fgets(str,10,stdin);
      |                      ^~~~~
main.c:1:1: note: 'stdin' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
  +++ |+#include <stdio.h>
    1 | int main(void)
main.c:9:22: note: each undeclared identifier is reported only once for each function it appears in
    9 |         fgets(str,10,stdin);
      |                      ^~~~~
main.c:10:9: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
   10 |         sscanf(str,"%d", &num1);
      |         ^~~~~~
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:10:9: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
main.c:10:9: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c:17:18: warning: comparison between pointer and integer
   17 |         if (str1 == '+') {
      |                  ^~
main.c:18:17: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
   18 |                 printf("%d\n", num1+num3);
      |                 ^~~~~~
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:18:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:18:17: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:20:23: warning: comparison between pointer and integer
   20 |         else if (str1 == '-') {
      |                       ^~
main.c:21:17: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
   21 |                 printf("%d\n", num1-num3);
      |                 ^~~~~~
main.c:21:17: note: include '<stdio.h>' or provide a declaration of 'printf'
Language: C

#include <stdio.h>
 
int main(void)
{
  int num;
  char num2;
  int num3;
  
  scanf("%d",&num);
  scanf("%c",&num2);
  scanf("%d",&num3);
  
  if(num2 == '+'){
    printf("%d\n",num1 + num3);
  }
  else if(num2 == '-'){
    printf("%d\n",num1 - num3);
  }
  
  return 0;
}
#include <stdio.h>
 
int main(void)
{
  int num;
  char num2;
  int num3;
  
  scanf("%d",&num1);
  scanf("%c",&num2);
  scanf("%d",&num3);
  
  if(num2 == '+'){
    printf("%d\n",num1 + num3);
  }
  else if(num2 == '-'){
    printf("%d\n",num1 - num3);
  }
  
  return 0;
}



Compiler output:
main.c: In function 'main':
main.c:14:19: error: 'num1' undeclared (first use in this function); did you mean 'num3'?
   14 |     printf("%d\n",num1 + num3);
      |                   ^~~~
      |                   num3
main.c:14:19: note: each undeclared identifier is reported only once for each function it appears in
main.c: At top level:
main.c:24:5: error: redefinition of 'main'
   24 | int main(void)
      |     ^~~~
main.c:3:5: note: previous definition of 'main' with type 'int(void)'
    3 | int main(void)
      |     ^~~~
main.c: In function 'main':
main.c:30:15: error: 'num1' undeclared (first use in this function); did you mean 'num3'?
   30 |   scanf("%d",&num1);
      |               ^~~~
      |               num3
Language: C

#include <stdio.h>
 
int main(void)
{
  int num;
  char num2;
  int num3;
  
  scanf("%d",&num);
  scanf("%c",&num2);
  scanf("%d",&num3);
  
  if(num2 == '+'){
    printf("%d\n",num1 + num3);
  }
  else if(num2 == '-'){
    printf("%d\n",num1 - num3);
  }
  
  return 0;
}

Compiler output:
main.c: In function 'main':
main.c:14:19: error: 'num1' undeclared (first use in this function); did you mean 'num3'?
   14 |     printf("%d\n",num1 + num3);
      |                   ^~~~
      |                   num3
main.c:14:19: note: each undeclared identifier is reported only once for each function it appears in