Help Sorting an array of supplied names

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • k1ckthem1dget
    New Member
    • Nov 2006
    • 15

    Help Sorting an array of supplied names

    I need to display the unsorted list of names and display the sorted list of names.

    My program is getting a bunch of errors though, and i dont know why.

    I am getting the following errors.

    28: error: cannot convert `char (*)[17]' to `int*' for argument `1' to `void showArray(int*, int)'
    33: error: expected unqualified-id before "for"
    33: error: expected constructor, destructor, or type conversion before '<' token
    33: error: expected constructor, destructor, or type conversion before '++' token
    38: error: expected identifier before '[' token
    40: error: expected initializer before "in"
    43: error: expected unqualified-id before "for"
    43: error: expected constructor, destructor, or type conversion before '<' token
    43: error: expected constructor, destructor, or type conversion before '++' token
    45: error: expected constructor, destructor, or type conversion before '=' token
    47: error: expected constructor, destructor, or type conversion before '<' token
    47: error: expected constructor, destructor, or type conversion before '++' token
    52: error: expected declaration before '}' token


    Here is my code. Any help is appreciated.


    #include <iostream>
    using namespace std;

    const int numNames = 10;
    const int nameSize = 17;
    void showArray(int [],char);
    void selectionSort(i nt [], int);
    int main()
    {
    char names [numNames][nameSize]=
    {"Collins,Bill" ,
    "Smith,Bart ",
    "Allen,Jim" ,
    "Griffin,Ji m",
    "Stamey,Mar ty",
    "Rose,Geri" ,
    "Taylor,Ter ri",
    "Johnson,Ji ll",
    "Allison,Je ff",
    "Looney,Joe "};

    showArray(names ,numNames);

    }
    void showArray(char array[], int SIZE);

    for(int counter = 0; counter < size; counter++)
    {
    cout << array[count] << endl;
    }

    void selectionSort(c har array[],[nameSize],int size)

    in counter, minRow;
    char minValue[17];

    for(counter = 0; counter < (SIZE - 1); counter++)
    minRow = counter;
    strcpy =(minValue,arra y[counter]

    for(int index = counter+1; index < SIZE; index++)
    { if(strcmp(array[index],minValue)<0)
    strcpy(minValue ,array[index]);
    minRow = index;
    }
    }
Working...