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 30 // Just defining it as my swap function may lead to more elements than 12(i.e. after the NULL character) (due to redundancies)
// Actually, just realized it can't but whatever
void get_input_character_string(char A[][MAX], int n)
                               {
                               for(int i =0;i<n;i++)
                                  {
                                  cin>>A[i];
                                  }
                               }
void string_swap(char* a, char* b)
                {
                 int i =0;
                 while(true)
                      {
                       if(a[i]!=0 &&b[i]!=0)
                         {
                          char temp = a[i];
                          a[i] = b[i];
                          b[i] = temp;
                          i++;
                         }
                       else break;
                      }
                 if(a[i] ==0 && b[i]==0)
                   {
                    a[i] =0;
                    b[i] =0;
                   }
                 else if(a[i] ==0)
                        {
                         a[i] = b[i];
                         b[i] = 0;
                         i++;
                         while(b[i] !=0)
                              {
                               a[i] = b[i];
                               i++;
                              }
                         a[i] =0;
                         }
                 else if(b[i] ==0)
                        {
                         b[i] = a[i];
                         a[i] = 0;
                         i++;
                         while(a[i] !=0)
                              {
                               b[i] = a[i];
                               i++;
                               }
                        b[i] =0;
                        }
                }
int string_compare(char* First, char* Second)
                   {
                   int i = 0;
                   while(true)
                        {
                         if(First[i] ==0 && Second[i] ==0) return 0;
                         if(First[i] == 0) return 1;
                         if(Second[i] ==0) return -1;
                         if(First[i] < Second[i] ) return 1;
                         if(First[i] > Second[i]) return -1;
                         i++;
                         }
                   }
void string_sort(char A[][MAX], int n)
                {
                 int i, j;
                 int string_compare_counter =0, string_swap_counter =0;
                 for(int i = 1; i<n; i++)
                    {
                    j = i;
                    while ( j>0)
                           {
                            if(string_compare(A[j-1],A[j])>=0)
                              {
                               string_compare_counter++;
                               break;
                              }
                            else
                              {
                              string_compare_counter++;
                               string_swap(A[j-1],A[j]);
                               string_swap_counter ++;
                               j--;
                              }
                            }
                     }
                 // Now to print it in reverse order
                 for(int i = n-1; i>=0;i--)
                    {
                    cout<<A[i]<<endl;
                    }
                 cout<<string_compare_counter<<endl<<string_swap_counter;
                }
int main()
{
/* Just testing the swap function out
char a[20],b[20];
cin>>a>>b;
string_swap(a,b);
cout<<endl<<a<<endl<<b;
*/
int n;
cin>>n;
char A[MAX][MAX];
get_input_character_string(A,n);
string_sort(A,n);

}

Grading criterion: Sorting algorithm implemented is insertion sort.
Rating A: Fully correct
Rating B: Almost correct
Rating C: Tried in somewhat right direction (e.g., different sorting algorithm)
Rating D: totally wrong
Assigned grade: A