469,578 Members | 1,670 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

Help Needed Asap Please Dealing With Sorting A List Of Names In An Array

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(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,numNames);

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

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

void selectionSort(char array[],[nameSize],int size)

in 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;
}
}
Nov 10 '06 #1
2 3003
Try posting that again with code tags
Nov 10 '06 #2
The first thing I see wrong is that when you call showArray() you have the arguments reversed, I think that explains error 28. Then next thing is that in the first for loop you are using "size", which doesn't look to ever be declared anywhere. Work on that and I'll help some more.
Nov 10 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Matthew Hood | last post: by
15 posts views Thread by Jay | last post: by
2 posts views Thread by rookiejavadude | last post: by
5 posts views Thread by jrod11 | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.