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
int string_compare(char str1[],char str2[])
{
	if (str1[0]==0 && str2[0]!=0) return 1;
	if (str1[0]!=0 && str2[0]==0) return -1;
	if (str1[0]==0 && str2[0]==0) return 0;
	for(int i=0;;i++)
	{
		if (str1[i]<str2[i]) return 1;
		if (str1[i]>str2[i]) return -1;
		if (str1[i]==0 && str2[i]==0) return 0;
		if (str1[i]==str2[i]) continue;
	}
}
void string_copy(char str[],char strcpy[])
{
	int i;
	for(i=0;str[i]!=0;i++)
	{
		strcpy[i]=str[i];
	}
	strcpy[i]=str[i];
}
void string_swap(char str1[],char str2[])
{
	char str3[max];
	string_copy(str1,str3);
	string_copy(str2,str1);          // remember tune copy kiya hai replace nhi issue aa skte hai
	string_copy(str3,str2);
}
void string_sort(char inputs[][max],int n,int &c1,int &c2)
{
	int i=1;
	for(;i<n;i++)
	{
		for(int j=i-1;j>=0;j--)
		{
			c1++;
			if(string_compare(inputs[i],inputs[j])==-1) {string_swap(inputs[i],inputs[j+1]);if(j!=i-1)c2++;break;}
			if(string_compare(inputs[i],inputs[j])==0) {string_swap(inputs[i],inputs[j+1]);if(j!=i-1)c2++;break;}
			if(j==0) 
			{
				for(int k=i;k>0;k--)
				{
					string_swap(inputs[k],inputs[k-1]);
					c2++;
				}
			}
			if(string_compare(inputs[i],inputs[j])==1) continue;
		}
	}
}
int main()
{
	int n,c1=0,c2=0;
	cin>>n;
	char inputs[n][max];
	for(int i=0;i<n;i++)
	{
		cin>>inputs[i];
	}
	string_sort(inputs,n,c1,c2);
	for(int i=n-1;i>=0;i--)
	{
		cout<<inputs[i]<<endl;
	}
	cout<<c1<<endl;
	cout<<c2;
	return 0;
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
}

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