CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>

void swap (float *a, float *b)
{
    float temp;
    temp = *a;
    *a = *b;
    *b = temp;
}

int argmin (float marks[], int L)
{
	int minindex = 0;
	for(int j=1; j<L; j++){
		
		if(marks[minindex] < marks[j]) minindex = j;
	}
	return minindex;
}


void selection_sort (float *data, int n)
{
    for(int i=n; i>1;i--)
    {
        int minindex = argmin(data,i); 
        swap(&data[minindex],&data[i-1]); 
    }
}


main_program
{
   
    int i,n;
     cin >> n;
      float A[n];

    for (i= 0; i < n; i++)
    {
        
        cin >> A[i];
    }

    
    


    selection_sort(A,n);
    
    for (i=0; i <n; i++)
    {
        cout << A[i] << " ";
    }
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0; i<n; i++){
        cin >> a[i];
    }    
    for(int i=0; i<n; i++){
        int p=i;
        for(int j=i; j<n; j++){
            if(a[p]>a[j]){
                p=j;
            }
        }    
        int t=a[i];
        a[i]=a[p];
        a[p]=t;
    }
    for(int i=0; i<n; i++){
        cout << *(a+i) << " ";
    }                
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;


int mini(int *a,int l)
    {
    int m=0;
    for (int i=0;i<l;i++)
        {
        if (a[m]>a[i]) m=i;
        }
    return m;
    }
    
    
void sort(int *d, int n)
    {
    for(int i=n;i>1;i--)
        {
        int minindex=mini(d,i);
        int temp=d[n-i];
        d[n-i]=d[minindex];
        d[minindex]=temp;
        }
    }
    

int main()
{    
int k;
cin>>k;
int a[k];
for(int i=0;i<k;i++)
    {
    cin>>a[i];
    }
sort(a,k);
for (int i=0;i<k;i++)
    {
    cout<<a[i]<<" ";
    }
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
void swap( float *a, float *b)
{
 float temp;
 temp =*a;
       *a=*b;
   *b=temp;
}

int gmin( float *g,int n)
{
int minindex=0;
for(int i=1; i<n; i++)
{ if (g[minindex]>g[i] ) {minindex=i;}}
return minindex;
 }
 
 void sort(float *d,int e)
 {
 for(int i=1; i<e+1; i++)
 {
 int minindex=gmin(d,i);
 swap(&d[minindex],&d[i-1]);
 }
 }
 
int main()
{
int n;
cin>>n;
float arr[n];
for(int i=0; i<n; i++)
{cin>>arr[i];}
sort(arr,n);
for(int i=0; i<n; i++)
{cout<<arr[i]<<" ";}
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;

void swap (float *a, float *b){
	
	float temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

int argmin (float *A, int m)
{
	int minindex = 0;
	for(int j=1; j<m; j++){
		if(A[minindex] < A[j]) minindex = j;
	}
	return minindex;
}

void sort (float *B, int n)
{
    for(int i=n; i>1;i--)
    {
        int minindex = argmin(B,i);
        swap(&B[minindex],&B[i-1]);
 
    }
}
int main()
{
    float A[25];
    int i,n;
    cin >> n;

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

        cin >> A[i];
    }

    sort(A,n);

    for (i= 0; i < n; i++)
    {
        cout << A[i] << " ";
    }
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>

void swap (float *a, float *b)
{
    float temp;
    temp = *a;
    *a = *b;
    *b = temp;
}

int argmin (float *marks, int L)
{
	int minindex = 0;
	for(int j=1; j<L; j++){
		if(marks[minindex] < marks[j]) minindex = j;
	}
	return minindex;
}


void selection_sort (float *data, int n)
{
    for(int i=n; i>1;i--)
    {
        int minindex = argmin(data,i); 
        swap(&data[minindex],&data[i-1]); 
        
    }
}
main_program
{
    float A[25];
    int i,n;
   cin >> n;

    for (i= 0; i < n; i++){
        cin >> A[i];
    }

 
    for (i= 0; i < n; i++)
    {
  }
	selection_sort(A,n);
    for (i= 0; i < n; i++)
    {
        cout <<A[i]<<" ";
    }
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
void sorta(int *a, int n)
{
for(int i=0; i<n; i++)
{
int mini=a[i];
int index=i;
for(int j=i+1; j<n; j++)
{
	if(mini>a[j]){mini=a[j];index=j;}
}
a[index]=a[i];
a[i]=mini;

}

}

int main()
{
 	int n;
 	cin>>n;
 	int A[n];
 	for(int i=0; i<n; i++)
 	{
 		cin>>A[i];
 	}
sorta(A, n);
 	for(int i=0; i<n; i++)
 	{
 		cout<<A[i]<<" ";

 	}

 	
 	return 0;

}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
void f(int*A,int i,int n)
{
int c, m,p;
m=min(A[i],A[i+1]);
c=m;
for(int j=i+2;j<n;j++)
	{
	m=min(c,A[j]);
	c=m;
	}
for(int k=0;k<n;k++)
{
if(A[k]==c)
{swap(A[i],A[k]);
}
}


}



main_program{
int  n;
cin>>n;
int A[n];
for(int i=0;i<n;i++)
	{
	cin>>A[i];
	}

int j;


repeat(250)

{
for(j=0;j<n;j++)
	{
	f(A,j,n);
	}

}

for(int k=0;k<n;k++)
{
cout<<A[k]<<" ";
}



}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include <simplecpp>
void swap (float *a, float *b)
{
	float temp;
	temp=*a;
	*a=*b;
	*b=temp;
}
int argmax (float *marks, int L)
{
	int maxindex=0;
	for(int j=0; j<L; j++){
	if (marks[maxindex] < marks[j]) maxindex=j;
	}
	return maxindex;
}
void selection_sort (float *data, int n)
{
	for (int i=n; i>1; i--)
	{
	int maxindex=argmax(data,i);
	swap (&data[i-1], &data[maxindex]);
	}
}
main_program
{
	float A[100];
	int i,n;
	cin>>n;
	for(i=0; i<n; i++)
	{
	cin>>A[i];
	}
	selection_sort (A, n);
	for(i=0; i<n; i++)
	{
	cout<<A[i]<<" ";
	}
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include <iostream>
using namespace std;
void swap(float*a, float *b){
	float temp = *a;
	*a = *b;
	*b = temp;
	}
int min_order(float *num, int L){
	int min_index=0;
	for(int j=0; j<L; j++){
		if(num[min_index]<num[j]) min_index=j;
		}
	return min_index;
	}
void arrange_num(float *data, int n){
	for(int i=n; i>1; i--){
			int min_index = min_order(data,i);
			swap(&data[min_index],&data[i-1]);
				}
	}
	
int main(){
float A[100];
int i, n;
cin >> n;

for(i=0; i<n; i++){
	cin >> A[i];
	}
arrange_num(A,n);
for(i=0; i<n; i++){
	cout << A[i] << " " ;
	}
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int argmin(int *a, int l) {
    int minindex=0;
    for(int j=0; j<l; j++) {
        if(a[j]<a[minindex]) minindex=j;
    } return minindex;
}
void swap(int *a, int *b) {
    int temp=*a; *a=*b; *b=temp;
    return;
}
void sort(int *a, int n) {
    for(int i=0; i<n; i++) {
        int k=argmin(a,n);
        swap(&a[k], &a[i]);
    } 
    for(int i=0; i<n; i++) {
        cout<<a[i]<<" ";
    }
}
int main() {
    int n;
    cin>>n;
    int *a;
    for(int i=0; i<n; i++) {
        cin>>a[i];
    } sort(a,n);
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;

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

for(int k=0;k<n;k++)
{
	for(int j=k;j<n;j++)
	{ if (a[j]==min(a[k],a[j]))
	 {int temp=a[k];
	 a[k]=a[j];
	 a[j]=temp;}
	 
	} cout<<a[k]<<" ";
	
}	
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
main_program{
	int n, array[24];
		cin>>n;
		for(int i=0; i<n; i++){
		cin>>array[i];
		}
		int temp;
		for(int i=0; i<n; i++){
		//int min=array[0];
		for(int j=i+1; j<n; j++){
		int min=array[0];
		if(min<array[j]) continue;
		else{ temp=array[j];
		array[j]=array[i];
		min=temp;
		}
		}
		cout<<array[n]<<" ";
		}
		//cout<<array[n]<<" ";
		}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<simplecpp>
main_program{
int v,k,t,n,m,i,j;
cin>>n;
int A[n],B[n];
for(i=0;i<n;i++)
cin>>A[i];
for(i=0;i<n;i++){
for(j=i+1;j<n;j++)
{m=A[j];
if(A[j+1]<m)
m=A[j];}
for(k=0;k<n;k++)
if(A[k]==m)
v=k;
if(A[i]>A[v]){
t=A[i];
A[i]=A[v];
A[v]=t;}}
for(i=0;i<n;i++)
cout<<A[i]<<" ";
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int Minindex(int *A, int n, int k)
{
  int minindex=n-1;	
  for(int i=n-2; i>=k; i--)
  {
   if(A[i]<A[minindex])
   {
   	minindex=i;
   }
  }
   return minindex;
}
int main()
{
	int n, index;
	cin>>n;
	int A[n];
	for(int j=0; j<n; j++)
	{
      cin>>A[j];
	}
	for(int k=0; k<n-1; k++)
	{
	   int temp;
       index=Minindex(A, n, k);
       temp=A[k];
       A[k]=A[index];
       A[index]=temp;
	}
	for(int y=0; y<n; y++)
	{
		cout<<A[y]<<" ";
	}	

}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int main()
{
int A[100],n,i,j;
cin>>n;
for(i=0;i<n;i++)
{
        cin>>A[i];
}
for(i=0;i<n-1;i++)
{
        for(j=i+1;j<n;j++)
        {
           if(A[i]>A[j])
           {
                   int temp;
                   temp=A[i];
                   A[i]=A[j];
                   A[j]=temp;
           }
        }
}
for(i=0;i<n;i++)
{
cout<<A[i]<<" ";
}
cout<<endl;
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,i,j;
cin>>n;
double A[n];
if(n<25){
for(i=0;i<n;i++){cin>>A[i];}
for(i=0;i<n-1;i++){
for(j=i+1;j<n;j++){
if(A[i]>=A[j]){
int temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
}
for(i=0;i<n;i++)
{cout<<A[i]<<" ";}
}
else cout<<"invalid output";
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;
void f(int *a,int n)
{
int m=0;
for(int j=0;j<n;j++)
{
	int p=1000;
	for(int i=m;i<n;i++)
	{
		if(a[i]>p)
		{
			continue;
		}
		else
			p=a[i];
	int r=a[j];
	a[j]=p;
	a[i]=r;
	}
m=m+1;
}
	for(int i=0;i<n;i++)
	{
		cout<<a[i]<<" ";
	}
}
int main()
{
	int n,x;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	{
		cin>>x;
		a[i]=x;
	}
	f(a,n);
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include <iostream>
using namespace std;
int main( ){
int n;
cin>>n;
int A[n];
for (int i=0;i<n;i++)
{cin>>A[i];}
for (int i=0;i<n;i++){
for (int j=0;j<n;j++){
if  (A[j]>A[i])
{int temp =A[j];
A[j]=A[i];
A[i]=temp;}}}
for (int i=0;i<n;i++){cout <<A[i]<<" ";}}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Write a C++ program to sort an array A of n numbers strictly using the given algorithm:

1. Find the minimum element in the array.
2. Swap the minimum element with the first element of the array.
3. Find the minimum element in the remaining array.
4. Swap the minimum element with the second element of the array.
5. Repeat steps 3 and 4 until the entire array is sorted.

Constraints:

* n < 25

Input Format:

* Non-negative integer n
* Array A of n elements

Output Format:

* Print the sorted array with a space between adjacent elements.

Student submission:
#include<iostream>
using namespace std;

int min (int A[], int N, int s){
int minindex = s;
for(int j=s; j<N; j++){
if(A[minindex] > A[j]) minindex = j;
}
return minindex;
}

void myswap (int& a, int& b){
int temp = a; a = b; b =temp; 
return;  int x = 10, y = 20;
}

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

    for(int i=0; i<n-1;i++){
        int minindex = min(Ar,n, i); 
        myswap(Ar[minindex],Ar[i]); 
    }   

    for(int i=0; i<n; i++)
    {
        cout << Ar[i] << " ";
    }
}

Grading criterion: Correctness of swapping minimum value and first element of array
Rating A: Swapping is correct
Rating B: Wrong swapping
Rating C: 0
Rating D: 0
Assigned grade: A