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 100
void swap(char a,char b)
{
char temp=a;
a=b;
b=temp;
}
  int  string_compare(char s1[MAX],char s2[MAX],int n)
  
  {int count =0;
  for(int i=0;i<n;i++)
  {
    if(s1[i]>s2[i])
    {  count++;
      return 1;
    }
    else{
    return -1;
    }
    if(s1[i]==s2[i]){
    return 0;}
    }
    return 0;}
    void string_sort(char s1[MAX],char s2[MAX],int n){
     int i,j;
     for(int i=0;i<n;i++)
     {
       j=i; while(j>0&&s1[j-1]>s1[j])
       {
          swap(&s1[j],&s1[j-1]);
           j=j-1;
           }
           }
     for(int i=0;i<n;i++)
     {
       j=i; while(j>0&&s1[j-1]>s1[j])
       {
          swap(&s2[j],&s2[j-1]);
           j=j-1;
           }
           }
           
           
           }
    
    void string_rev(char s1[MAX],char s2[MAX],int n){
    n=string_length(s1);
      for(int i=0;i<n/2;i++)
      {swap(&s1[i],&s1[n-1-i]);
      s1[n]=0;
      }
      for(int i=0;i<n/2;i++)
      {swap(&s2[i],&s2[n-1-i]);
      s2[n]=0;
      }
      for(int i=0;i<n;i++)
      {
      cout<<s1[i]<<' ';
      }cout<<"\n";
      for(int i=0;i<n;i++)
      {
      cout<<s2[i]<<' ';
      }cout<<"\n";
      cout<<"n"<<"\n";
      int t=n/2;
      cout<<t;
      
      
    }
  int main(){
   cin>>n;if(n>8){
   return 0;}
   char a[MAX][MAX],s1[MAX],s2[MAX];
   for(int i=0;i<2;i++){
   
   for(int j=0;j<n;j++)
   {
     cin>>a[i][j];
     }
     for(int i=0;i<n;i++)
     {
     s1[i]=a[i][0];
     }
     for(int i0;i<n;i++)
     
     {
     s2[i]=a[i][1];
     }
     
     string_compare(s1,s2,n);
     string_sort(s1,s2,n);
     string_rev(s1,s2,n);
     }
     }

Grading criterion: Sort implemented in function string_sort
Rating A: Fully Correct
Rating B: Almost correct
Rating C: tried in somewhat right direction
Rating D: totally wrong
Assigned grade: C