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(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[10],numNames);
}
void showArray(char array [], char SIZE);
for(counter = 0, counter < size, counter++)
{
cout << array[count] << endl;
}
}
void selectionSort(c har array[],[nameSize],int size)
{
cin 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;
}
Any help is greatly appreciated.