By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,603 Members | 1,477 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,603 IT Pros & Developers. It's quick & easy.

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

P: 15
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
Share this Question
Share on Google+
2 Replies


P: 8
Try posting that again with code tags
Nov 10 '06 #2

P: 8
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.