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<iostream>
using namespace std;
void swap(int *a,int *b)
{ int temp=*a;
	*a=*b;
	*b=temp;
}
 int minindex(float*A,int n)
{
	int index=0;
	for(int i=0;i<n;i++)
	{
		if (A[i]>A[i+1]) index=i;
	}
	return index;
}
void selection_sort(float* A,int n)
{
	for (int i=n;i>0;i--)
	{
		for (int j=0;j<i;j++){
			ind=minindex(A,i);
			swap(A[ind],A[j]);
		}

	}
}
void print(float*A,int n)
{
	for(int i=0;i<n;i++)
	cout<<A[i]<<" ";
}

int main()
{
	float A[25];
	int n;
	cin>>n;
	for (int i=0;i<n;i++) cin>>A[i];
selection_sort(A,n);
cout<<print;


	
	return 0;
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: C
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 (float *scores, int L)
	{
	int minindex=0;
	for (int j=0; j<L; j++)
		{
		if (scores[minindex]>scores[j]) minindex=0;
		}
	return minindex;
	}

void selction_sort (float *data, int n)
	{
	for(int i=n; i>1; i--)
		{
		int minindex=argmin(data,i);
		
		void swapV (int a=&data[minindex], int b=&data[i-1])
		int temp=a; ab; b=temp; return;
		}
	}
int main()
	{
	int n;
	cin >> n;
	int A[n];
		for(int i=0; i<n; i++)
			{
			cin >> A[i];
			}
	}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
int minval(int *a, int n, int l){
	int p=n-1;
	for(int j=n-1; j>l-1; j=j-1){
		if(a[p] > a[j]) p = j;	
	}
	return p;
}

main_program{
	int n;cin>>n;int a[n];
	for(int i=0;i<n;i=i+1){cin>>a[i];}
	for(int i=0;i<n;i=i+1){
		int min;min=minval(a,n,i);
		swap(a[min],a[i]);
	}
	for(int i=0;i<n;i=i+1){
		cout<<a[i]<<" ";
	}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
#include<cmath>
using namespace std;



int min_index(int *a, int n, int index)
{
	int mini=index;
	for(int i=index;i<n;i++)
	{
		if(a[mini]>a[i])
		{
			mini=i;
		}
	}
	return mini;
}
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 mini=min_index(a,n,i);
		int temp= a[i];
		a[i]=a[mini];
		a[mini]=temp;
	}

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



}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 i,j,n;
cin>>n;
int A[n];
for(i=0;i<n;i++)
cin>>A[i];
for(i=0;i<n;i++)
{
for(j=i;j<n;j++)
{
if(A[j]<A[i])
{
int temp;
temp=A[i];
A[i]=A[j];
A[j]=temp;
}
}
}
for(i=0;i<n;i++)
cout<<A[i]<<" ";
return 0;
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 arr[n];

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

for(int i=0;i<n-1;i++){for(int j=i+1;j<n;j++)
                      {int temp =arr[j];
                       arr[j]=arr[i];
                       arr[i]=temp;}}


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




}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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;
double min(float* a,int n,int k)
{
	float m=min(a[k],a[k+1]);
	for (int i=k+2; i<n;i++)
	{
		if(m>=a[i]){m=a[i];}
	}
	return m;
		
}
void swap(float &a, float &b)
{
	float temp =a;
	a=b;
	b=temp;
}
int main()
{
	int n;
	cin>>n;
	float a[n];
	for (int i=0; i<n;i++)
	{
		cin>>a[i];
	}
	for(int k=0;k<n;k++)
	{
		for(int i=k;i<n;i++)
		{
			if(min(a,n,k)==a[i])
			{swap(a[i],a[k]);}
		}
	}
	for (int i=0; i<n;i++)
	{
		cout<<a[i]<<" ";
	}
	
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: C
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 sort_array(int *arr[],int n)
	int min;
	min=arr[0];
	for (int i=0;i < n;i+=1){
		int j;
		for ( j=i+1;j < n;j+=1){
			if (arr[j]<min){
				min=arr[j];   
			}
		arr[j]=arr[i];
		arr[i]=min;
		}
	}
int main(){
int n;
cin>>n;

int arr[n];

for (int i=0;i < n;i +=1){
	cin>>arr[i];
	}
sort_array(arr,n);

for (int j=0;i < n;j+=1){
	cout<<arr[i]<<" ";
	}	
	
return 0;
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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=i;j<n;j++)
		{
			if(A[i]>=A[j])
			{
				int temp=A[i];
				    A[i]=A[j];
				    A[j]=temp;
			}
		}
		cout<<A[i]<<" ";
	}
}

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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 argmin (int A[], int n)
{
  int minindex = 0;
   for(int j=1; j<n; j++)
    {
     if(A[minindex] > A[j])
     minindex = j;
     }
    }
 void sort (int B[], int n)
 {
   for (int i=1; i<n; i++)
   {
   int minindex = argmin(B, i);
   myswap(&B[minindex], &B[i-1]);
   }
 }

int main(){
cin>>n; 
int A[n];
for(int k=0; k<n; k++){
       cin>>A[K];
   }
   cout<<B[n];
   }

Grading criterion: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>

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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: C
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>

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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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>
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
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: Quality of variable names
Rating A: Good variable names
Rating B: Ok Variable Names
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A