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

int main()
{
	cin >> n;
	for (int i = 0; i<n; i++) cin >> a[i];

	int ans = 0;
        for(int i=0;i<n;i++) {
         int minj = i;
         for(int j=i;j<n;;j++) {
           if(a[minj] > a[j]) {
              minj = j;
           }
         }
         if(i != minj) {
          int v = a[i];a[i] = a[minj];a[minj]=a[i];
          ans++;
         }
        }

        print();
        cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:3:9: error: 'cin' was not declared in this scope
    3 |         cin >> n;
      |         ^~~
a.cc:3:16: error: 'n' was not declared in this scope
    3 |         cin >> n;
      |                ^
a.cc:4:42: error: 'a' was not declared in this scope
    4 |         for (int i = 0; i<n; i++) cin >> a[i];
      |                                          ^
a.cc:9:26: error: expected primary-expression before ';' token
    9 |          for(int j=i;j<n;;j++) {
      |                          ^
a.cc:9:26: error: expected ')' before ';' token
    9 |          for(int j=i;j<n;;j++) {
      |             ~            ^
      |                          )
a.cc:9:27: error: 'j' was not declared in this scope
    9 |          for(int j=i;j<n;;j++) {
      |                           ^
a.cc:15:19: error: 'a' was not declared in this scope
   15 |           int v = a[i];a[i] = a[minj];a[minj]=a[i];
      |                   ^
a.cc:20:9: error: 'print' was not declared in this scope; did you mean 'int'?
   20 |         print();
      |         ^~~~~
      |         int
a.cc:21:9: error: 'cout' was not declared in this scope
   21 |         cout << ans << endl;
      |         ^~~~
a.cc:21:24: error: 'endl' was not declared in this scope
   21 |         cout << ans << endl;
      |                        ^~~~
Language: C++

int ssort(int *A, int N) {
  auto cnt = 0;
  for (int i = 0; i < N; i++) {
    auto mini = i;
    for (int j = i + 1; j < N; j++) {
      if (A[mini] > A[j]) mini = j;
    }
    if (mini != i) {
      int temp;
      temp = A[i];
      A[i] = A[mini];
      A[mini] = temp;
      cnt++;
    }
  }
  return cnt;
}

int main(void) {
  int N, A[100];
  
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
  
  auto cnt = ssort(A, N);
  
  for (int i = 0; i < N; i++) {
    if (i != 0) cout << " ";
    cout << A[i];
  }
  cout << endl;
  cout << cnt << endl;
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:3: error: 'cin' was not declared in this scope
   22 |   cin >> N;
      |   ^~~
a.cc:28:17: error: 'cout' was not declared in this scope
   28 |     if (i != 0) cout << " ";
      |                 ^~~~
a.cc:29:5: error: 'cout' was not declared in this scope
   29 |     cout << A[i];
      |     ^~~~
a.cc:31:3: error: 'cout' was not declared in this scope
   31 |   cout << endl;
      |   ^~~~
a.cc:31:11: error: 'endl' was not declared in this scope
   31 |   cout << endl;
      |           ^~~~
Language: C++

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

using namespace std;

int count_sw = 0;

void ss(int A[],int N){
    for (int i = 0; i < N-1; i++) {
        int min = A[i]
        int k = i;
        for (int j = i+1; j < N; j++) {
            if (min > A[j]) {
                min = A[j];
                k = j;
            }
        }
        if (i != k) {
            swap(A[k],A[i]);
            count_sw++;
    }
}

int main(){
    int N;
    cin >> N;
    
    int *A;
    A = (int *)malloc(sizeof(int));
    
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    ss(A,N);
    
    for(int i = 0; i < N; i++){
        cout << A[i];
        if (i != N-1){
            cout << " ";
        }
    }
    cout << endl;
    
    cout << count_sw << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void ss(int*, int)':
a.cc:13:9: error: expected ',' or ';' before 'int'
   13 |         int k = i;
      |         ^~~
a.cc:17:17: error: 'k' was not declared in this scope
   17 |                 k = j;
      |                 ^
a.cc:20:18: error: 'k' was not declared in this scope
   20 |         if (i != k) {
      |                  ^
a.cc:26:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   26 | int main(){
      |         ^~
a.cc:26:9: note: remove parentheses to default-initialize a variable
   26 | int main(){
      |         ^~
      |         --
a.cc:26:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:26:11: error: a function-definition is not allowed here before '{' token
   26 | int main(){
      |           ^
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:10:23: note: to match this '{'
   10 | void ss(int A[],int N){
      |                       ^
Language: C++

//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_B&lang=jp

#include <iostream>
#include <algorithm>


using namespace std;

int main(){
  int n, times=0;
  cin >> n;
  int A[n];
  for(int i = 0; i<n; i++){
    cin >> A[i];
  }
  //???????????????
  int minj;

  for(int i = 0; i<n; i++){
    minj = i;
    for(int j = i+; j<n; j++){
      if(A[j] < A[minj]){
        minj = j;
      }
    }
    if(i != minj){
    swap(A[i],A[minj]);
    times++;
    }
  }

  for(int i = 0; i<n-1; i++){
    cout << A[i] << " ";
  }
  cout << A[n-1] << endl;
  cout << times << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:19: error: expected primary-expression before ';' token
   21 |     for(int j = i+; j<n; j++){
      |                   ^
Language: C++

#include<iostream>
using namespace std;

int main(){

  int n,a[100];
  int min,tmp,sum=0;

  cin >> n;
  for(int i=0; i<n; i++)
    cin >> a[i];


  for(int i=0; i<n; i++){
    min = i;
    for(int j=i; j<n; j++){
      if(a[j] < a[min])
	min = j;
    }

    if(min!=i){
      tmp = a[i];
      a[i] = a[min];
      a[min] = tmp;
      sum++;
    }

  }
   
  cout << a[0];
  for(int i=1; i<n; i++)
    cout << ' ' <<a[i];

  cout << endl << sum << endl;


  return 0;

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

#include <iostream>
#include <stdio.h>

void swap(int *a, int *b){

  int v = *a;
  
  *a = *b;

  *b = v;
}

int choicesort(int *A, int N){

  int count = 0;
  int i,j;
  for(j = 0; j < N-1; j++){
    mini = j;
    for(i = j+1; i < N;i++){
      if(A[i] < A[minj]){
	mini = i;
      }
    }
    if(mini != j){
      swap(&A[j],&A[mini]);
      count++;
    }
  }
  return count;
}


int main(void){

  int N;
  int i;
  int c;

  while(~scanf("%d",&N)){
    
    int *A = new int[N];
    
    for(i=0;i < N;i++) scanf("%d", &A[i]);
    
    c = choicesort(A, N);
    
    std::cout << A[0];
    for(i=1;i < N;i++){
      std::cout << " " << A[i]; 
    }
    std::cout << std::endl;
    std::cout << c << std::endl;
    
    delete []A;

  }
  
  return 0;
}

Compiler output:
a.cc: In function 'int choicesort(int*, int)':
a.cc:18:5: error: 'mini' was not declared in this scope
   18 |     mini = j;
      |     ^~~~
a.cc:20:19: error: 'minj' was not declared in this scope
   20 |       if(A[i] < A[minj]){
      |                   ^~~~
Language: C++

#include<stdio.h>
main(){
  int n,A[100],mini,cnt=0,x;
  int i,j;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  for(i=0;i<n;i++){
    mini = i;
    for(j=i;j<n;j++){
      if(A[j] < A[mini]){
        mini = j;
      }
      if(mini!=i){
        x = A[i];
        A[i] = A[mini];
        A[mini] = x;
        cnt++;
      }
    }
  }
  for(i=0;i<n-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n%d"\n",A[n-1],cnt);
}

Compiler output:
a.cc:26:18: error: stray '\' in program
   26 |   printf("%d\n%d"\n",A[n-1],cnt);
      |                  ^
a.cc:26:20: warning: missing terminating " character
   26 |   printf("%d\n%d"\n",A[n-1],cnt);
      |                    ^
a.cc:26:20: error: missing terminating " character
   26 |   printf("%d\n%d"\n",A[n-1],cnt);
      |                    ^~~~~~~~~~~~~~
a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    2 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:26:18: error: expected ')' before 'n'
   26 |   printf("%d\n%d"\n",A[n-1],cnt);
      |         ~        ^~
      |                  )
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int cnt = 0;
void SelectionSort(int A[], int N){
  for(int i = 0; i < N; i++){
    minj = i;
    for(int j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
        cnt++;
      }
      swap(A[i],A[minj]);
    }
  }
}
int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++) 
    cin >> A[i];
  SelectionSort(A,N);
  for(int i = 0; i < N; i++){
    cout << A[i];
    if(i = N-1) cout << '\n';
    else cout << " ";
  }
  cout << cnt << '\n';
}

Compiler output:
a.cc: In function 'void SelectionSort(int*, int)':
a.cc:7:5: error: 'minj' was not declared in this scope
    7 |     minj = i;
      |     ^~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int cnt;
void SelectionSort(int A[], int N){
  for(int i = 0; i < N; i++){
    int minj = i;
    for(int j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
      }
    }
    swap(A[i],A[minj]);
    if(i != minj) cnt++;
  }
  return (cnt);
}
int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++)
    cin >> A[i];
  cnt = SelectionSort(A,N);
  for(int i = 0; i < N; i++){
    cout << A[i];
    if(i = N-1) cout << '\n';
    else cout << " ";
  }
  cout << cnt << '\n';
}

Compiler output:
a.cc: In function 'void SelectionSort(int*, int)':
a.cc:16:11: error: return-statement with a value, in function returning 'void' [-fpermissive]
   16 |   return (cnt);
      |          ~^~~~
a.cc: In function 'int main()':
a.cc:24:22: error: void value not ignored as it ought to be
   24 |   cnt = SelectionSort(A,N);
      |         ~~~~~~~~~~~~~^~~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
int cnt;
void SelectionSort(int A[], int N){
  cnt = 0;
  for(int i = 0; i < N; i++){
    int minj = i;
    for(int j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
      }
    }
    swap(A[i],A[minj]);
    if(i != minj) cnt++;
  }
  return (cnt);
}
int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++)
    cin >> A[i];
  cnt = SelectionSort(A,N);
  for(int i = 0; i < N; i++){
    cout << A[i];
    if(i = N-1) cout << '\n';
    else cout << " ";
  }
  cout << cnt << '\n';
}

Compiler output:
a.cc: In function 'void SelectionSort(int*, int)':
a.cc:17:11: error: return-statement with a value, in function returning 'void' [-fpermissive]
   17 |   return (cnt);
      |          ~^~~~
a.cc: In function 'int main()':
a.cc:25:22: error: void value not ignored as it ought to be
   25 |   cnt = SelectionSort(A,N);
      |         ~~~~~~~~~~~~~^~~~~
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;
void SelectionSort(int A[], int N){
  int cnt = 0;
  for(int i = 0; i < N; i++){
    int minj = i;

    for(int j = i; j < N; j++){
      if(A[j] < A[minj]){
        minj = j;
      }
    }

    swap(A[i],A[minj]);
    if(i != minj) cnt++;
  }
  return cnt;
}
int main(){
  int N;
  cin >> N;
  int A[N];
  for(int i = 0; i < N; i++)
    cin >> A[i];
  int cnt = SelectionSort(A,N);
  for(int i = 0; i < N; i++){
    cout << A[i];
    if(i = N-1) cout << endl;
    else cout << " ";
  }
  cout << cnt << endl;
}

Compiler output:
a.cc: In function 'void SelectionSort(int*, int)':
a.cc:18:10: error: return-statement with a value, in function returning 'void' [-fpermissive]
   18 |   return cnt;
      |          ^~~
a.cc: In function 'int main()':
a.cc:26:26: error: void value not ignored as it ought to be
   26 |   int cnt = SelectionSort(A,N);
      |             ~~~~~~~~~~~~~^~~~~
Language: C++

//============================================================================
// 
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

//============================================================================
void selectionsort(void)
{
    int i,j,n,minj,*ary;

    scanf("%d", &n);
    ary=malloc(n*sizeof(int));
    for (i=0; i<n; i++)
        scanf("%d", &ary[i]);
    for (i=0; i<n-1; i++){
        for (j=minj=i; j<n; j++){
            if (ary[j]<ary[minj])
                minj=j;
        }
        j=ary[i], ary[i]=ary[minj], ary[minj]=j;
    }
    for (i=0; i<n; i++){
        if (i) printf(" ");
        printf("%d", ary[i]);
    }
    printf("\n");
}
//============================================================================
int main(void)
{
    selectionsort();
    return 0;
}
//============================================================================

Compiler output:
a.cc: In function 'void selectionsort()':
a.cc:13:15: error: invalid conversion from 'void*' to 'int*' [-fpermissive]
   13 |     ary=malloc(n*sizeof(int));
      |         ~~~~~~^~~~~~~~~~~~~~~
      |               |
      |               void*
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N, A[100], res;

void Out() {
	cout << A[0];
	for (int i = 1; i < N; i++)
		cout << ' ' << A[i];
	cout << endl;
}

void SelectionSort() {
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (A[j] < A[minj]) {
				minj = j;
			}
		}
		if (i != j) {
			int tmp = A[i];
			A[j] = A[minj];
			A[minj] = tmp;
			res++;
		}
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
	SelectionSort();
	Out();
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void SelectionSort()':
a.cc:20:26: error: 'j' was not declared in this scope
   20 |                 if (i != j) {
      |                          ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
int N, A[100], res;

void Out() {
	cout << A[0];
	for (int i = 1; i < N; i++)
		cout << ' ' << A[i];
	cout << endl;
}

void SelectionSort() {
	for (int i = 0; i < N; i++) {
		int minj = i;
		for (int j = i; j < N; j++) {
			if (A[j] < A[minj]) {
				minj = j;
			}
		}
		if (i != minj) {
			int tmp = A[i];
			A[j] = A[minj];
			A[minj] = tmp;
			res++;
		}
	}
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++)
		cin >> A[i];
	SelectionSort();
	Out();
	cout << res << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void SelectionSort()':
a.cc:22:27: error: 'j' was not declared in this scope
   22 |                         A[j] = A[minj];
      |                           ^
Language: C++

#include<stdio.h>
void swap(int *a, int *b){
	int c;
	c=*a;
	*a=*b;
	*b=c;
}
int main(void){
	int N,i,a[101],j,k=0,min;
	scanf("%d",&N);
	for(i=0;i<N-1;i++){
		scanf("%d ",&a[i]);
	}
	scanf("%d",&a[N-1]);
	for(i=0;i<N;i++){
		min=i;
		for(j=i;j<N;j++){
			if(a[j]<a[mini]){
				min=j;
				swap(&a[i],&a[mini]);
				k++;
			}
		}
	}
	for(i=0;i<N-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d\n",a[N-1]);
	printf("%d\n",k);
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:35: error: 'mini' was not declared in this scope; did you mean 'min'?
   18 |                         if(a[j]<a[mini]){
      |                                   ^~~~
      |                                   min
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;

int selectinsert(int A[], int n){
  int i,j,minv,sw;
    for ( i = 0;i<n;i++){
      minv=i;
      for (j=n-1;i>j;j--){
        if(A[i]>A[j]){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
      if(i != minv){
      sw +=1
      }
  }
  return sw;
}

int main(){
  int n, i, j,sw;
  int A[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  sw=selectinsert(A,n);
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);
  return 0;
}

Compiler output:
a.cc: In function 'int selectinsert(int*, int)':
a.cc:16:13: error: expected ';' before '}' token
   16 |       sw +=1
      |             ^
      |             ;
   17 |       }
      |       ~
Language: C++

#include<stdio.h>
#include<iostream>
using namespace std;

int selectinsert(int A[], int n){
  int i,j,minv,sw;
    for ( i = 0;i<n-1;i++){
      minv=i;
      for (j=i;N>j;j++){
        if(A[minv]>A[j]){
        minv=j;
        }
      }
      swap(A[i],A[minv]);
      if(i != minv){
      sw +=1;
      }
  }
  return sw;
}

int main(){
  int n, i, j,sw;
  int A[100];
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ) scanf("%d", &A[i]);
  sw=selectinsert(A,n);
  for ( i = 0; i < n; i++ ){
    if ( i > 0 ) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);
  return 0;
}

Compiler output:
a.cc: In function 'int selectinsert(int*, int)':
a.cc:9:16: error: 'N' was not declared in this scope
    9 |       for (j=i;N>j;j++){
      |                ^
Language: C++

#include <cstdio>
#define DEBUG(d,n) {for (int i = 0; i < n; i++) {\
                        if (i != n-1)   printf("%d ", d[i]);\
                        else            printf("%d", d[i]);\
                    }   printf("\n");}
#define SWAP(d,a,b) {	int t = d[a];\
						d[a] = d[b];\
						d[b] = t;}
const int MAX = 100;

void selectSort2(int d[], int len) {
	static int lps = 0;
	// firstly, we sort i-th before
	for (int i = 0; i < len; i++) {
		//DEBUG(d, len);
		
		int pos = 0, min = 1000000000;	// pos indicate selecting minimun value fron i-th to end
		for (int j = i; j < len; j++) {
			if (min > d[j])	{
				min = d[j];
				pos = j;
			}
		}
		// Swap
		SWAP(d,i,pos);
		if (i != mini)	// wtf????? ?£( ?°????°|||)
			lps++;
	}

	DEBUG(d, n);
	printf("%d\n", lps);
}

int main() {
    int n, d[MAX];
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &d[i]);
     
    bubbleSort(d, n);

    return 0;
}

Compiler output:
a.cc: In function 'void selectSort2(int*, int)':
a.cc:26:26: error: 'mini' was not declared in this scope; did you mean 'min'?
   26 |                 if (i != mini)  // wtf????? ?£( ?°????°|||)
      |                          ^~~~
      |                          min
a.cc:30:18: error: 'n' was not declared in this scope
   30 |         DEBUG(d, n);
      |                  ^
a.cc:2:41: note: in definition of macro 'DEBUG'
    2 | #define DEBUG(d,n) {for (int i = 0; i < n; i++) {\
      |                                         ^
a.cc: In function 'int main()':
a.cc:40:5: error: 'bubbleSort' was not declared in this scope
   40 |     bubbleSort(d, n);
      |     ^~~~~~~~~~
Language: C++

#include <cstdio>
#define DEBUG(d,n) {for (int i = 0; i < n; i++) {\
                        if (i != n-1)   printf("%d ", d[i]);\
                        else            printf("%d", d[i]);\
                    }   printf("\n");}
#define SWAP(d,a,b) {	int t = d[a];\
						d[a] = d[b];\
						d[b] = t;}
const int MAX = 100;

void selectSort2(int d[], int len) {
	static int lps = 0;
	// firstly, we sort i-th before
	for (int i = 0; i < len; i++) {
		//DEBUG(d, len);
		
		int pos = 0, min = 1000000000;	// pos indicate selecting minimun value fron i-th to end
		for (int j = i; j < len; j++) {
			if (min > d[j])	{
				min = d[j];
				pos = j;
			}
		}
		// Swap
		SWAP(d,i,pos);
		if (i != pos)	// wtf????? ?£( ?°????°|||)
			lps++;
	}

	DEBUG(d, len);
	printf("%d\n", lps);
}

int main() {
    int n, d[MAX];
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &d[i]);
     
    bubbleSort(d, n);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:5: error: 'bubbleSort' was not declared in this scope
   40 |     bubbleSort(d, n);
      |     ^~~~~~~~~~
Language: C++

#include<iostream>
#include <cstdio>
#include <algorithm>
 
using namespace std;
 
int main() {
 
    int N, A[100],minj;
    int count = 0;
 
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];
 
    for (int i = 0; i < N-1 ; i++) {
        minj = i;
        for (int j = i; j < N; j++) {
            if (A[j] < A[minj])
                minj = j;
        }
            swap(A[i], A[minj]);
            if (i != minj) count++;
    }
 
    for (int i = 0; i < N; i++) {
        if (i != 0) cout << " ";
        cout << A[i];
    }
    putchar('\n');
 
    cout << count << endl;
 
    return 0;
 

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

#include<stdio.h>

void selectionSort(A[],N){

   int i,j;

   for(i=0;i<N;i++){

      minj=i;

      for(j=i;j<N;j++){

         if (A[j] < A[minj]){
           minj = j;
         }
      }
   }
}

int main(){

   int N,i,j;
   int A[];

   scanf("%d\n",&N);
   for(i=0;i<N;i++){
      scanf("%d",&a[i]);
   }

   selectionSort(A,N);

   return 0;

}
   

Compiler output:
a.cc:3:6: error: variable or field 'selectionSort' declared void
    3 | void selectionSort(A[],N){
      |      ^~~~~~~~~~~~~
a.cc:3:20: error: 'A' was not declared in this scope
    3 | void selectionSort(A[],N){
      |                    ^
a.cc:3:22: error: expected primary-expression before ']' token
    3 | void selectionSort(A[],N){
      |                      ^
a.cc:3:24: error: 'N' was not declared in this scope
    3 | void selectionSort(A[],N){
      |                        ^
a.cc: In function 'int main()':
a.cc:23:8: error: storage size of 'A' isn't known
   23 |    int A[];
      |        ^
a.cc:27:19: error: 'a' was not declared in this scope
   27 |       scanf("%d",&a[i]);
      |                   ^
a.cc:30:4: error: 'selectionSort' was not declared in this scope
   30 |    selectionSort(A,N);
      |    ^~~~~~~~~~~~~
Language: C++

#include<stdio.h>

void selectionSort(int A[],int N){

   int i,j;

   for(i=0;i<N;i++){

      minj=i;

      for(j=i;j<N;j++){

         if (A[j] < A[minj]){
           minj = j;
         }
      }
   }
}

int main(){

   int N,i,j;
   int A[];

   scanf("%d\n",&N);

   for(i=0;i<N;i++){
      scanf("%d",&a[i]);
   }

   selectionSort(A,N);

   return 0;

}
   

Compiler output:
a.cc: In function 'void selectionSort(int*, int)':
a.cc:9:7: error: 'minj' was not declared in this scope
    9 |       minj=i;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:23:8: error: storage size of 'A' isn't known
   23 |    int A[];
      |        ^
a.cc:28:19: error: 'a' was not declared in this scope
   28 |       scanf("%d",&a[i]);
      |                   ^
Language: C++

#include<stdio.h>

void selectionSort(int A[],int N){

   int i,j;

   for(i=0;i<N;i++){

      minj=i;

      for(j=i;j<N;j++){

         if (A[j] < A[minj]){
           minj = j;
         }
      }
   }
}

int main(){

   int N,i,j;
   int A[100];

   scanf("%d\n",&N);

   for(i=0;i<N;i++){
      scanf("%d",&a[i]);
   }

   selectionSort(A,N);

   return 0;

}
   

Compiler output:
a.cc: In function 'void selectionSort(int*, int)':
a.cc:9:7: error: 'minj' was not declared in this scope
    9 |       minj=i;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:28:19: error: 'a' was not declared in this scope
   28 |       scanf("%d",&a[i]);
      |                   ^
Language: C++

#include<stdio.h>

void selectionSort(int A[],int N){

   int i,j;

   for(i=0;i<N;i++){

      minj=i;

      for(j=i;j<N;j++){

         if (A[j] < A[minj]){
           minj = j;
         }
      }
   }
}

int main(){

   int N,i,j;
   int A[100];

   scanf("%d",&N);

   for(i=0;i<N;i++){
      scanf("%d",&a[i]);
   }

   selectionSort(A,N);

   return 0;

}
   

Compiler output:
a.cc: In function 'void selectionSort(int*, int)':
a.cc:9:7: error: 'minj' was not declared in this scope
    9 |       minj=i;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:28:19: error: 'a' was not declared in this scope
   28 |       scanf("%d",&a[i]);
      |                   ^
Language: C++

#include<stdio.h>

void trace(int A[], int N){
 int i;
 for(i = 0;i< N;i++){
  if(i>0)printf(" ");
  printf("%d",A[i]);
 } 
 printf("\n");
}

void selectionSort(int A[], intN){
 int j,i,v;
 for(i=1;i<N;i++){
  v=A[i];
  j=i-1;
  while (j>=0 && A[j]>v){
   A[j+1]=A[j];
   j--;
   }
  A[j+1]=v;
  trace(A,N);
  }
 }
int main () {
 int N,i,j;
 int A[100];

 scanf("%d",&N);
 for(i=0;i<N;i++)scanf("%d",&A[i]);

 trace(A,N)
 selectionSort(A,N);
 return 0;
}

Compiler output:
a.cc:12:29: error: 'intN' has not been declared
   12 | void selectionSort(int A[], intN){
      |                             ^~~~
a.cc: In function 'void selectionSort(int*, int)':
a.cc:14:12: error: 'N' was not declared in this scope
   14 |  for(i=1;i<N;i++){
      |            ^
a.cc: In function 'int main()':
a.cc:32:12: error: expected ';' before 'selectionSort'
   32 |  trace(A,N)
      |            ^
      |            ;
   33 |  selectionSort(A,N);
      |  ~~~~~~~~~~~~~
Language: C++

#include<stdio.h>

void selectionSort(int A[],int N){

   int i,j;

   for(i=0;i<N;i++){

      minj=i;

      for(j=i;j<N;j++){

         if (A[j] < A[minj]){
           minj = j;
         }

        printf("%d",minj);

      }
   }
}

int main(){

   int N,i,j;
   int A[100];

   scanf("%d",&N);

   for(i=0;i<N;i++){
      scanf("%d",&a[i]);
   }

   selectionSort(A,N);

   return 0;

}
   

Compiler output:
a.cc: In function 'void selectionSort(int*, int)':
a.cc:9:7: error: 'minj' was not declared in this scope
    9 |       minj=i;
      |       ^~~~
a.cc: In function 'int main()':
a.cc:31:19: error: 'a' was not declared in this scope
   31 |       scanf("%d",&a[i]);
      |                   ^
Language: C++

#include<stdio.h>

int selectionSort(int A[],int N){

   int i,j;

   for(i=0;i<N;i++){

      minj=i;

      for(j=i;j<N;j++){

         if (A[j] < A[minj]){
           minj = j;
         }

        printf("%d",minj);

      }
   }
}

int main(){

   int N,i,j;
   int A[100];

   scanf("%d",&N);

   for(i=0;i<N;i++){
      scanf("%d",&a[i]);
   }

   selectionSort(A,N);

   return 0;

}
   

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:9:7: error: 'minj' was not declared in this scope
    9 |       minj=i;
      |       ^~~~
a.cc:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
   21 | }
      | ^
a.cc: In function 'int main()':
a.cc:31:19: error: 'a' was not declared in this scope
   31 |       scanf("%d",&a[i]);
      |                   ^
Language: C++

#include<stdio.h>
int selectionSort(int A[], int N){
 int i,j,t,sw=0,minj;
 for(i=0;i<N-1;i++){
  minj=i;
  for(j=i;j<N;j++){
   if(A[j]<A[minj])minj=j;
    }
  t= A[i];A[i]=A[minj];A[minj]=t;
  if(i!=minj)sw++;
  }
 return sw;
}
int main(){
 int A[100],N,i,sw;

 scanf("%d",&N);
 for(i=0;i<N;i++) scanf("%d",&A[i]);
   
  sw=selectionSort(A,N);
  for(i=0;i<N;i++){
   if(i>0)printf(" ");
   printf("%d",A[i]);
   }
  printf("\n");
  printf("%d\n",sw);
 return 0;
}


 return 0;
}

Compiler output:
a.cc:31:2: error: expected unqualified-id before 'return'
   31 |  return 0;
      |  ^~~~~~
a.cc:32:1: error: expected declaration before '}' token
   32 | }
      | ^
Language: C++

#include<stdio.h>
int selectionSort(int a[], int n)
{
int i, j, t, sw = 0, minj;
for(i=0;i<n-1;i++){
 minj = i;
 for(j=i;j<n;j++){
  if(a[j]<a[minj])
  minj=j;
  }
  t = a[i];
  a[i] = a[minj];
  a[minj] = t;
  if(i!=minj)
  sw++; 
}
return sw;
}


int main(void)
{
int i, n, a[100], sw;

scanf("%d", &n);
for(i=0;i<0;i++)
scanf("%d", &a[i]);

sw = selectionSort(a, n);

for(i=0;i<n;i++)
if(i>0)
printf(" ");
printf("%d", a[i]);
}
printf("\n");
printf("%d\n", sw);

return 0;
}

Compiler output:
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 | printf("\n");
      |       ^
a.cc:37:7: error: expected constructor, destructor, or type conversion before '(' token
   37 | printf("%d\n", sw);
      |       ^
a.cc:39:1: error: expected unqualified-id before 'return'
   39 | return 0;
      | ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include<stdio.h>
int selectionSort(int a[], int N)
{
int i, j, t, sw = 0, minj;
for(i=0;i<N-1;i++){
 minj = i;
 for(j=i;j<N;j++){
  if(a[j]<A[minj])
  minj=j;
  }
  t = A[i];
  A[i] = a[minj];
  a[minj] = t;
  if(i!=minj)
  sw++; 
}
return sw;
}


int main(void)
{
int i, n, A[100], sw;

scanf("%d", &N);
for(i=0;i<0;i++)
scanf("%d", &A[i]);

sw = selectionSort(A, N);

for(i=0;i<N;i++)
if(i>0)
printf(" ");
printf("%d", A[i]);
}
printf("\n");
printf("%d\n", sw);

return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:8:11: error: 'A' was not declared in this scope
    8 |   if(a[j]<A[minj])
      |           ^
a.cc:11:7: error: 'A' was not declared in this scope
   11 |   t = A[i];
      |       ^
a.cc: In function 'int main()':
a.cc:25:14: error: 'N' was not declared in this scope
   25 | scanf("%d", &N);
      |              ^
a.cc: At global scope:
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 | printf("\n");
      |       ^
a.cc:37:7: error: expected constructor, destructor, or type conversion before '(' token
   37 | printf("%d\n", sw);
      |       ^
a.cc:39:1: error: expected unqualified-id before 'return'
   39 | return 0;
      | ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include<stdio.h>
int selectionSort(int a[], int N)
{
int i, j, t, sw = 0, minj;
for(i=0;i<N-1;i++){
 minj = i;
 for(j=i;j<N;j++){
  if(A[j]<A[minj])
  minj=j;
  }
  t = A[i];
  A[i] = A[minj];
  a[minj] = t;
  if(i!=minj)
  sw++; 
}
return sw;
}


int main(void)
{
int i, n, A[100], sw;

scanf("%d", &N);
for(i=0;i<0;i++)
scanf("%d", &A[i]);

sw = selectionSort(A, N);

for(i=0;i<N;i++)
if(i>0)
printf(" ");
printf("%d", A[i]);
}
printf("\n");
printf("%d\n", sw);

return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:8:6: error: 'A' was not declared in this scope
    8 |   if(A[j]<A[minj])
      |      ^
a.cc:11:7: error: 'A' was not declared in this scope
   11 |   t = A[i];
      |       ^
a.cc: In function 'int main()':
a.cc:25:14: error: 'N' was not declared in this scope
   25 | scanf("%d", &N);
      |              ^
a.cc: At global scope:
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 | printf("\n");
      |       ^
a.cc:37:7: error: expected constructor, destructor, or type conversion before '(' token
   37 | printf("%d\n", sw);
      |       ^
a.cc:39:1: error: expected unqualified-id before 'return'
   39 | return 0;
      | ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include<stdio.h>
int selectionSort(int A[], int N)
{
int i, j, t, sw = 0, minj;
for(i=0;i<N-1;i++){
 minj = i;
 for(j=i;j<N;j++){
  if(A[j]<A[minj])
  minj=j;
  }
  t = A[i];
  A[i] = A[minj];
  a[minj] = t;
  if(i!=minj)
  sw++; 
}
return sw;
}


int main(void)
{
int i, n, A[100], sw;

scanf("%d", &N);
for(i=0;i<0;i++)
scanf("%d", &A[i]);

sw = selectionSort(A, N);

for(i=0;i<N;i++)
if(i>0)
printf(" ");
printf("%d", A[i]);
}
printf("\n");
printf("%d\n", sw);

return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:13:3: error: 'a' was not declared in this scope
   13 |   a[minj] = t;
      |   ^
a.cc: In function 'int main()':
a.cc:25:14: error: 'N' was not declared in this scope
   25 | scanf("%d", &N);
      |              ^
a.cc: At global scope:
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 | printf("\n");
      |       ^
a.cc:37:7: error: expected constructor, destructor, or type conversion before '(' token
   37 | printf("%d\n", sw);
      |       ^
a.cc:39:1: error: expected unqualified-id before 'return'
   39 | return 0;
      | ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include<stdio.h>
int selectionSort(int A[], int N)
{
int i, j, t, sw = 0, minj;
for(i=0;i<N-1;i++){
 minj = i;
 for(j=i;j<N;j++){
  if(A[j]<A[minj])
  minj=j;
  }
  t = A[i];
  A[i] = A[minj];
  A[minj] = t;
  if(i!=minj)
  sw++; 
}
return sw;
}


int main(void)
{
int i, N, A[100], sw;

scanf("%d", &N);
for(i=0;i<0;i++)
scanf("%d", &A[i]);

sw = selectionSort(A, N);

for(i=0;i<N;i++)
if(i>0)
printf(" ");
printf("%d", A[i]);
}
printf("\n");
printf("%d\n", sw);

return 0;
}

Compiler output:
a.cc:36:7: error: expected constructor, destructor, or type conversion before '(' token
   36 | printf("\n");
      |       ^
a.cc:37:7: error: expected constructor, destructor, or type conversion before '(' token
   37 | printf("%d\n", sw);
      |       ^
a.cc:39:1: error: expected unqualified-id before 'return'
   39 | return 0;
      | ^~~~~~
a.cc:40:1: error: expected declaration before '}' token
   40 | }
      | ^
Language: C++

#include<stdio.h>

int main (void)
{
  int a[100], n, i, j, temp, count = 0;
  
  scanf("%d", &n);
  for (i = 0; i < n; ++i)
  {
    scanf("%d", &a[i]);
  }
  
  for (i = 0; i < n; ++i)
  {
    minj = i;
    for (j = 0; j < n; ++j)
    {
      if (a[j] < a[minj]) minj = j;
      temp = a[i];
      a[i] = a[minj];
      a[minj] = temp;
      count++;
    }
  }
  
  for (i = 0; i < n; ++i)
  {
    printf("%d ", a[i]);
  }
  printf("\n");
  printf("%d", count);
  
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'minj' was not declared in this scope
   15 |     minj = i;
      |     ^~~~
Language: C++

include<stdio.h>

int main (void) {
	int i, n, minj, j, a[100], count = 0, temp;
	
	scanf("%d", &n);
	for (i = 0; i < n; ++i) scanf("%d", &a[i]);
	
	for (i = 0; i < n; ++i)
	{
		minj = i;
		for (j = i; j < n; ++j)
		{
			if (a[j] < a[minj]) minj = j;
		}
		if (i != minj)
		{
			temp = a[i];
			a[i] = a[minj];
			a[minj] = temp;
			++count;
		}
	}
	
	for (i = 0; i < n; ++i)
	{
		printf("%d ", a[i]);
	}
	
	printf("\n%d", count);
	
	return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include<stdio.h>
      | ^~~~~~~
Language: C++

#include<stdio.h>
void SelectionSort(int *,int);
#define N 100 
  
 main(){
   int i ,A[N] ,n;
   scanf("%d", &n);
   for(i = 0; i < n; i++) scanf("%d", &A[i]);
   SelectionSort(A, n);
 
  return 0;
}
 
 void SelectionSort(int a, int b){
   int i,j,minj, koukan ,count=0;
   for(i=0; i < b; i++){
     minj = i;
     for(j=i; j < b ; j++) {
      if(a[j] < a[minj]){
     minj = j;
      }
    }
    
    if(i != minj) {
     count++;
    }
    koukan = a[i];
    a[i] = a[minj];
      a[minj] = koukan;
  }
   
  for(i=0; i < b - 1; i++){
  printf("%d ",a[i]);
  }
  printf("%d\n", a[b-1]);
  printf("%d\n", count);
}

Compiler output:
a.cc:5:2: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 |  main(){
      |  ^~~~
a.cc: In function 'void SelectionSort(int, int)':
a.cc:19:11: error: invalid types 'int[int]' for array subscript
   19 |       if(a[j] < a[minj]){
      |           ^
a.cc:19:18: error: invalid types 'int[int]' for array subscript
   19 |       if(a[j] < a[minj]){
      |                  ^
a.cc:27:15: error: invalid types 'int[int]' for array subscript
   27 |     koukan = a[i];
      |               ^
a.cc:28:6: error: invalid types 'int[int]' for array subscript
   28 |     a[i] = a[minj];
      |      ^
a.cc:28:13: error: invalid types 'int[int]' for array subscript
   28 |     a[i] = a[minj];
      |             ^
a.cc:29:8: error: invalid types 'int[int]' for array subscript
   29 |       a[minj] = koukan;
      |        ^
a.cc:33:17: error: invalid types 'int[int]' for array subscript
   33 |   printf("%d ",a[i]);
      |                 ^
a.cc:35:19: error: invalid types 'int[int]' for array subscript
   35 |   printf("%d\n", a[b-1]);
      |                   ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


int main(){
int minj,cnt=0,N,A[100];
cin >> N 

for(int i=0;i<N;i++)cin >> A[i];

for(int i=0;i<N;i++){
     minj = i
     for(j=0;j<N;j++){
       if (A[j] < A[minj]) minj = j
    }
     if(minj!=i){
      swap(A[minj],A[i]);cnt++;
     }
for(int i=0;i<N;i++){cout << A[i] ; if(i!=N-1)cout << " ";}
 cout << endl << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:8:9: error: expected ';' before 'for'
    8 | cin >> N
      |         ^
      |         ;
    9 | 
   10 | for(int i=0;i<N;i++)cin >> A[i];
      | ~~~      
a.cc:10:13: error: 'i' was not declared in this scope
   10 | for(int i=0;i<N;i++)cin >> A[i];
      |             ^
a.cc:13:14: error: expected ';' before 'for'
   13 |      minj = i
      |              ^
      |              ;
   14 |      for(j=0;j<N;j++){
      |      ~~~      
a.cc:14:14: error: 'j' was not declared in this scope
   14 |      for(j=0;j<N;j++){
      |              ^
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


int main(){
int minj,cnt=0,N,A[100];
cin >> N ;

for(int i=0;i<N;i++)cin >> A[i];

for(int i=0;i<N;i++){
     minj = i;
     for(j=0;j<N;j++){
       if (A[j] < A[minj]) minj = j;
    }
     if(minj!=i){
      swap(A[minj],A[i]);cnt++;
     }
for(int i=0;i<N;i++){cout << A[i] ; if(i!=N-1)cout << " ";}
 cout << endl << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:10: error: 'j' was not declared in this scope
   14 |      for(j=0;j<N;j++){
      |          ^
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<iostream>
#include<algorithm>
using namespace std;


int main(){
int minj,cnt=0,N,A[100];
cin >> N ;

for(int i=0;i<N;i++)cin >> A[i];

for(int i=0;i<N;i++){
     minj = i;
     for(int j=0;j<N;j++){
       if (A[j] < A[minj]) minj = j;
    }
     if(minj!=i){
      swap(A[minj],A[i]);cnt++;
     }
for(int i=0;i<N;i++){cout << A[i] ; if(i!=N-1)cout << " ";}
 cout << endl << cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:2: error: expected '}' at end of input
   22 | }
      |  ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^
Language: C++

#include<stdio.h>

int selectionSort(int A[], int N) {
  int i, j, t, sw = 0, minj;
  for ( i = 0; i < N - 1; i++ ) {
    minj = i;
    for ( j = i; j < N; j++ ) {
      if( A[j] < A[minj} ) minj = j;
    }
    t = A[i]; A[i] = A[minj]; A[minj] = t;
    if ( i != minj ) sw++;
  }
  return sw;
}

int main() {
  int A[100], N, i, sw;

  scanf("%d", &N);
  for ( i = 0; i <N; i++) scanf("%d", &A[i]);

  sw = selectionSort(A, N);

  for ( i = 0; i < N; i++ ) {
    if ( i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
  printf("%d\n", sw);

  return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:8:24: error: expected ']' before '}' token
    8 |       if( A[j] < A[minj} ) minj = j;
      |                        ^
      |                        ]
a.cc:8:24: error: expected ')' before '}' token
    8 |       if( A[j] < A[minj} ) minj = j;
      |         ~              ^
      |                        )
a.cc:8:24: error: expected primary-expression before '}' token
a.cc:8:26: error: expected primary-expression before ')' token
    8 |       if( A[j] < A[minj} ) minj = j;
      |                          ^
a.cc:12:3: warning: no return statement in function returning non-void [-Wreturn-type]
   12 |   }
      |   ^
a.cc: At global scope:
a.cc:13:3: error: expected unqualified-id before 'return'
   13 |   return sw;
      |   ^~~~~~
a.cc:14:1: error: expected declaration before '}' token
   14 | }
      | ^
Language: C++

int selectionSort(int A[], int N){
  int sw = 0;
  for (size_t i = 0; i < N-1; i++) {
    int minj = i;
    for (size_t j = i+1; j < N; j++) {
      if (A[minj] > A[j]) {
        minj = j;
      }
    }
    swap(A[i],A[minj]);
    if (minj != i) {
      sw++;
    }
  }
  return sw;
}

int main() {
  int n; // a number of scores
  scanf("%d", &n);

  int arr[100];

  for (size_t i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
  }

  int ans = selectionSort(arr, n);
  for (size_t k = 0; k < n; k++) {
      printf("%d%c",arr[k],(k==n-1)? '\n':' ');
  }
  printf("%d\n", ans);
  return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:3:8: error: 'size_t' was not declared in this scope
    3 |   for (size_t i = 0; i < N-1; i++) {
      |        ^~~~~~
a.cc:1:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
  +++ |+#include <cstddef>
    1 | int selectionSort(int A[], int N){
a.cc:3:22: error: 'i' was not declared in this scope
    3 |   for (size_t i = 0; i < N-1; i++) {
      |                      ^
a.cc:5:16: error: expected ';' before 'j'
    5 |     for (size_t j = i+1; j < N; j++) {
      |                ^~
      |                ;
a.cc:5:26: error: 'j' was not declared in this scope
    5 |     for (size_t j = i+1; j < N; j++) {
      |                          ^
a.cc:10:5: error: 'swap' was not declared in this scope; did you mean 'sw'?
   10 |     swap(A[i],A[minj]);
      |     ^~~~
      |     sw
a.cc: In function 'int main()':
a.cc:20:3: error: 'scanf' was not declared in this scope
   20 |   scanf("%d", &n);
      |   ^~~~~
a.cc:24:8: error: 'size_t' was not declared in this scope
   24 |   for (size_t i = 0; i < n; i++) {
      |        ^~~~~~
a.cc:24:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:24:22: error: 'i' was not declared in this scope
   24 |   for (size_t i = 0; i < n; i++) {
      |                      ^
a.cc:29:8: error: 'size_t' was not declared in this scope
   29 |   for (size_t k = 0; k < n; k++) {
      |        ^~~~~~
a.cc:29:8: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
a.cc:29:22: error: 'k' was not declared in this scope
   29 |   for (size_t k = 0; k < n; k++) {
      |                      ^
a.cc:30:7: error: 'printf' was not declared in this scope
   30 |       printf("%d%c",arr[k],(k==n-1)? '\n':' ');
      |       ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
  +++ |+#include <cstdio>
    1 | int selectionSort(int A[], int N){
a.cc:32:3: error: 'printf' was not declared in this scope
   32 |   printf("%d\n", ans);
      |   ^~~~~~
a.cc:32:3: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
Language: C++

#include<iostream>
using namespace std;

void main()
{
	int arr[100],n,cnt=0,min_i;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> arr[i];
	for (int i = 0; i < n; i++)
	{
		min_i = i;
		for (int j = i + 1; j < n; j++)
		{
			if (arr[min_i] > arr[j])min_i = j;
		}
		if (min_i != i)
		{
			swap(arr[min_i], arr[i]);
			cnt++;
		}
	}
	for (int i = 0; i < n; i++)
	{
		cout << arr[i];
		if (i != n - 1)cout << " ";
	}
	cout << endl << cnt << endl;
}

Compiler output:
a.cc:4:1: error: '::main' must return 'int'
    4 | void main()
      | ^~~~
Language: C++

#include "stdafx.h"
#include<iostream>
using namespace std;

int selectionSort(int A[], int N) {
	int sw;
	for (int i = 0; i < N - 1; i++) {
		int min = A[i];
		for (int j = i; j < N; j++) {
			if (A[j] < min) min = A[j];
		}
		swap(min, A[i]);
		if (A[i] != min) sw++;
	}
	return sw;
}

int main()
{
	int A[100], N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	int sw = selectionSort(A, N);

	for (int i = 0; i < N; i++) {
		if (i > 0) cout << " ";
		cout << A[i];
	}
	cout << endl;
	cout << sw;
    return 0;
}

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

#include<iostream>
using namespace std;

int selectionSort(int A[], int N) {
        int i, j, t, sw = 0; mini;
        for(i = 0; i < N - 1; i++) {
                mini = i;
                for(j = i; j < N; j++) {
                        if(A[j] < A[mini]) mini = j;
                }
                swap(A[i], A[mini]);
                if(i != mini) sw++;
        }
        return sw;
}       

int main() {
        int A[100], N, i, sw;
        cin >> N;
        for(i = 0; i < N; i++) cin >> A[N];
        sw = slectionSort(A, N);
        for(i = 0; i < N; i++) {
                if(i) cout << " ";
                cout << A[i];
        }
        cout << endl;
        cout << sw;
        return 0;
}

Compiler output:
a.cc: In function 'int selectionSort(int*, int)':
a.cc:5:30: error: 'mini' was not declared in this scope
    5 |         int i, j, t, sw = 0; mini;
      |                              ^~~~
a.cc: In function 'int main()':
a.cc:21:14: error: 'slectionSort' was not declared in this scope; did you mean 'selectionSort'?
   21 |         sw = slectionSort(A, N);
      |              ^~~~~~~~~~~~
      |              selectionSort
Language: C++

#Include<iostream>
using namespace std;
#include<algorithm>

int selectionSort(int A[], int N) {
	int i, j, mini, sw = 0;
	for(i = 0; i < N; i++) {
		mini = i;
		for(j = i; j < N; j++) {
			if(A[j] < A[mini]) mini = j;
		}
		swap(A[i], A[mini]);
		if(i != mini) sw++;
	}	
	return sw;
}

int main () {
	int N, A[100], sw, i;
	cin >> N;
	for(i = 0; i < N; i++) cin >> A[i];
	sw = selectionSort(A, N);
	for(i = 0; i < N; i++) {
		if(i > 0) cout << " ";
		cout << A[i];
	}
	cout << A[i];
	cout << sw;
	return 0;
}

Compiler output:
a.cc:1:2: error: invalid preprocessing directive #Include; did you mean #include?
    1 | #Include<iostream>
      |  ^~~~~~~
      |  include
a.cc: In function 'int main()':
a.cc:20:9: error: 'cin' was not declared in this scope
   20 |         cin >> N;
      |         ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include<algorithm>
  +++ |+#include <iostream>
    4 | 
a.cc:24:27: error: 'cout' was not declared in this scope
   24 |                 if(i > 0) cout << " ";
      |                           ^~~~
a.cc:24:27: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:25:17: error: 'cout' was not declared in this scope
   25 |                 cout << A[i];
      |                 ^~~~
a.cc:25:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:27:9: error: 'cout' was not declared in this scope
   27 |         cout << A[i];
      |         ^~~~
a.cc:27:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'