I am trying to write a program which sorts an array of supplied names.
Here are the errors i am getting.
33: error: expected unqualified-id before "for"
37: error: expected declaration before '}' token
AND HERE IS MY CODE
#include <iostream>
using namespace std;
const int numNames = 10;
const int nameSize = 17;
void showArray(char [],char);
void selectionSort(int [], int);
int main()
{
char names [numNames][nameSize]=
{"Collins,Bill",
"Smith,Bart",
"Allen,Jim",
"Griffin,Jim",
"Stamey,Marty",
"Rose,Geri",
"Taylor,Terri",
"Johnson,Jill",
"Allison,Jeff",
"Looney,Joe"};
showArray(names[10],numNames);
}
void showArray(char array [], char SIZE);
for(counter = 0, counter < size, counter++)
{
cout << array[count] << endl;
}
}
void selectionSort(char array[],[nameSize],int size)
{
cin counter, minRow;
char minValue[17];
for(counter = 0; counter < (SIZE - 1); counter++)
minRow = counter;
strcpy =(minValue,array[counter]
for(int index = counter+1; index < SIZE; index++)
{ if(strcmp(array[index],minValue)<0)
strcpy(minValue,array[index]);
minRow = index;
}
Any help is greatly appreciated.