I'm new at C++ ..and I dont know what should I do whith my program ...
this program's input for exg. is:
mary sara kimi lili olive
and then sorting them .. but my problem is that when I submit my home work they score me "0" and Icant find out why..!

#include <iostream>
#include <string.h>
#define MAXNAMES 100
using namespace std;

int compare(string s1, string s2){
  int i;
    for ( i = 0; s1[i] && s2[i]; ++i)
        /* If characters are same or inverting the 6th bit makes them same */
        if (s1[i] == s2[i] || (s1[i] ^ 32) == s2[i])

    /* Compare the last (or first mismatching in case of not same) characters */
    if (s1[i] == s2[i])
        return 0;
    if ((s1[i]|32) < (s2[i]|32)) //Set the 6th bit in both, then compare
        return -1;
    return 1;

int main() {
    string Names[MAXNAMES];
  int index[MAXNAMES], tmp;

  int n;
  for(int i=0; i<n; i++)

  for(int i=0; i<n; i++)  index[i] = i;

  int min;

  for(int i=0; i<n-1; i++){
    min = i;
    for(int j=i+1; j<n; j++)
     if( compare(Names[index[j]], Names[index[min]]) < 0 ) {
       min = j;
    if(min != i){
      tmp = index[i];
      index[i] = index[min];
      index[min] = tmp;

  for(int i=0; i<n; i++)  

    return 0;
This question has already been answered. Start a new discussion instead.