Problem: Title - Sorting strings using insertion sort

Problem Description: 
Write a C++ program to collect a positive integer n from the user, and then collect n character strings from the user (containing only lower case alphabets and no other characters, not even spaces). The strings need not be of equal length but the maximum length of any string should be 11. The strings should be stored in an appropriate 2D array. Your program should then include the following:A function string_compare which takes two strings as input and returns 1 if the first string appears before the second string in augmented alphabetical order, -1 if the second string appears before the first in augmented alphabetical order, and 0 if the two strings are equal to each other. A function string_sort which sorts the character strings using the insertion-sort algorithm taught in class. Your program should then print out the strings sorted in reverse alphabetical order, starting from the last to the first. Your program should also print the number of string_compare operations (i.e. how many times the string_compare routine was called) and the number of string swaps performed. 

Input Format - integer n, and a set of n character strings
Output Format - Print out the strings in the suggested order, one string on a new line

Constraints
n is a positive integer, n < 15
The maximum length of any of the strings should be 11, excluding the NULL character.
The character strings should contain only lower case alphabets

Sample input and output
Input: 4 efs abc zbdf word
Output (on console): zbdf word efs abc 4 2

Student submission:
#include <iostream>

using namespace std;

# define MAX 12

int string_compare(char *s1, char *s2)
{
    int i = 0;
    while (s1[i] != '\0' && s2[i] != '\0')
    {
        if (s1[i] < s2[i])
        {
            return 1;
        }
        else if(s1[i] > s2[i])
        {
            return -1;
        }
        i++;
    }
    return 0;
}

void swap_string(char s1[], char s2[])
{
    int n1 = 0, n2 = 0;
    while (s1[n1++] != '\0');
    n1--;
    while (s2[n2++] != '\0');
    n2--;

    int c = 0;

    while (c <= n1 && c <= n2)
    {
        char a;
        a = s1[c];
        s1[c] = s2[c];
        s2[c] = a;
        c++;
    }

    while (c <= n1)
    {
        s2[c] = s1[c];
        c++;
    }

    while (c <= n2)
    {
        s1[c] = s2[c];
        c++;
    }
}

void string_sort(char a[][MAX], int n, int &compare_count, int &swap_count)
{
    for (int i = 1; i < n; i++)
    {
        int j = i;

        while (j > 0 && string_compare(a[j], a[j - 1]) + compare_count > compare_count++)
        {
            swap_string(a[j], a[j - 1]);
            swap_count++;
            j--;
        }
    }
}

int main()
{
    int n;
    cin >> n;
    char a[n][MAX];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int swap_count = 0;
    int compare_count = 0;

    string_sort(a, n, compare_count, swap_count);

    for (int i = n - 1; i >= 0; i--)
    {
        cout << a[i] << endl;
    }
    cout << compare_count << endl;
    cout << swap_count << endl;
}

Grading criterion: Sort implemented not in function
Rating A: If separate function is used and function signature is correct
Rating B: If separate function is used but function signature is not correct
Rating C: 0
Rating D: 0
Assigned grade: A