Thread: using selection sort with a 2D char array

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    30

    using selection sort with a 2D char array

    Hi,
    I need to perform a selectionSort on a two dimensional array of characters and for some reason, although the code is compiling, when I start the executable, nothing happens. Could someone help me please?
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    char initArray();
    void selectionSort(char names[20][17]);
    int searchName(char names[20][17]);
    int binarySearch(char array[1][17], char names[20][17]);
    
    
    int main()
    {
    char initArray();
    }
    
    char initArray()
    {
    		const int NUM_NAMES= 20, SIZE = 17;
    		char names[NUM_NAMES][SIZE]= {"Collins, Bill", "Smith, Bart", "Allen, Jim", 
    									  "Griffin, Jim", "Stamey, Marty", "Rose, Geri",
    									  "Taylor, Terri", "Johnson, Jill", 
    									  "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", 
    									  "James, Jean", "Weaver, Jim", "Pore, Bob", 
    									  "Rutherford, Greg", "Javens, Renee", 
    									  "Harrison, Rose", "Setzer, Cathy", 
    									  "Pike, Gordon", "Holland, Beth"};
    		return names[20][17];
    		selectionSort(names); 
    		
    }
    void selectionSort(char names[][17])
    		{
    
    			int number, startScan[81], minIndex[81], elems;
    			elems = 17;
    			char minValue[1][17];
    			for (number = 0; number < (elems - 1); number++)
    				{
    				minIndex[81] = number;
    				strcpy(minValue[17], names[17]);
    				for (int index = number+1; index < elems; index++)
    				{
    
    					if (strcmp(names[number], minValue[81]) != 0)
    					{
    					strcpy(minValue[81], names[number]);
    					minIndex[81] = index;
    					}
    				} 
    		strcpy(names[index], names[number]);
    		strcpy(names[number], minValue[17]);
    		}
     searchName(names[20][17]);
    }
    } 
    int searchName(char names[][17])
    			{
    			char name[1][17];
    			int position;
    			cout << "Please enter a name putting the last name first.\n";
    			cin >> name[0][17];
    			binarySearch(name, names);
    			cout << name << " was found here: " << position << "\n";
    			exit(0);
    			return position;
    		    }
    int binarySearch(char name[1][17], char names[][17])
    {
    
    int elems = 17,
    first = 0,
    last = elems - 1,
    middle,
    position = -1;
    bool found = false;
    
    while (!found && first <= last)
    	{
    	middle = (first + last)/2;
    	if(strcmp(names[middle], name[17]) == 0)
    	{
    		found = true;
    		position = middle;
    	}
    	else if 
    		(strcmp(names[middle], name[17]) <= 1)
    		last = middle - 1;
    	else
    		first = middle +1;
    }
    return position; 
    }

  2. #2
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    I stopped reading here:
    Code:
    return names[20][17];
    So will your program.
    There is a difference between tedious and difficult.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    so, how would I fix that? Exactly what am I doing wrong here?

    Any help would be greatly appreciated.

    Thanks,
    Kristen

  4. #4
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    I take it back. Your program never gets to that line of code.
    I assume that you want
    Code:
    int main()
    {
    char initArray();
    }
    to call the function initArray. All (I think) that's doing is declaring a function prototype, local to main.

    Answer two questions, then we can get started:

    How do you declare variable/function?
    How do you call a function?
    There is a difference between tedious and difficult.

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    you declare a variable by giving the type, name, and then possiibly initializing it, right? And you declare a function using the prototype which requires the return type, the function name and the arguments, right? Sorry I missed that. Here's the end result after I have corrected that error:
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    char initArray();
    void selectionSort(char names[20][17]);
    int searchName(char names[20][17]);
    int binarySearch(char array[1][17], char names[20][17]);
    
    
    int main()
    {
    initArray();
    }
    
    char initArray()
    {
    		const int NUM_NAMES= 20, SIZE = 17;
    		char names[NUM_NAMES][SIZE]= {"Collins, Bill", "Smith, Bart", "Allen, Jim", 
    									  "Griffin, Jim", "Stamey, Marty", "Rose, Geri",
    									  "Taylor, Terri", "Johnson, Jill", 
    									  "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", 
    									  "James, Jean", "Weaver, Jim", "Pore, Bob", 
    									  "Rutherford, Greg", "Javens, Renee", 
    									  "Harrison, Rose", "Setzer, Cathy", 
    									  "Pike, Gordon", "Holland, Beth"};
    		return names[20][17];
    		selectionSort(names); 
    		
    }
    void selectionSort(char names[][17])
    		{
    
    			int number, startScan[81], minIndex[81], elems;
    			elems = 17;
    			char minValue[1][17];
    			for (number = 0; number < (elems - 1); number++)
    				{
    				minIndex[81] = number;
    				strcpy(minValue[17], names[17]);
    				for (int index = number+1; index < elems; index++)
    				{
    
    					if (strcmp(names[number], minValue[81]) != 0)
    					{
    					strcpy(minValue[81], names[number]);
    					minIndex[81] = index;
    					}
    					strcpy(names[index], names[number]);
    					strcpy(names[number], minValue[17]);
    				} 
    		
    		}
     searchName(names);
    }
    int searchName(char names[][17])
    {
    	char name[1][17];
    	int position;
    			
    	cout << "Please enter a name putting the last name first.\n";
    	cin >> name[0][17];
    	binarySearch(name, names);
        cout << name << " was found here: " << position << "\n";
    	exit(0);
    	return position;
    }
    int binarySearch(char name[1][17], char names[][17])
    {
    
    int elems = 17,
    first = 0,
    last = elems - 1,
    middle,
    position = -1;
    bool found = false;
    
    while (!found && first <= last)
    	{
    	middle = (first + last)/2;
    	if(strcmp(names[middle], name[17]) == 0)
    	{
    		found = true;
    		position = middle;
    	}
    	else if 
    		(strcmp(names[middle], name[17]) <= 1)
    		last = middle - 1;
    	else
    		first = middle +1;
    }
    return position; 
    }
    I tried taking out the brackets on the return names[20][17]; but I get an error for that.
    Code:
     error C2440: 'return' : cannot convert from 'char [20][17]' to 'char'

  6. #6
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    Good. Now there are a few errors that I see within initArray. First, the one you pointed out:
    Code:
     error C2440: 'return' : cannot convert from 'char [20][17]' to 'char'
    'names' is a char array. Your function returns a single char. The compiler is saying that it can't take 'names' and return a single character from it. It doesn't know how to do that. The problem is, you don't want it to anyway.
    I imagine you want to return the sorted list of names. The problem with that is that you can't return an array without pointers, and there's no way we're going there right now.
    I would pass the array by reference. If you do so, your function won't have to return anything. Then it would be a ______ function?

    Now that I think about it, that clears up the other problem with that function, but for the sake of understanding, how many lines of code after the return statement does a value-returning function 'execute'? Execute isn't the right word, but the right word isn't coming to me right now. Apply that answer to why selectionSort() doesn't seem to be running.

    Can't write more now, I'll try to check on your progress a little later...
    Last edited by Decrypt; 04-02-2006 at 05:24 PM. Reason: clarification
    There is a difference between tedious and difficult.

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    OK, I tried to pass by reference, don't know if I am doing it right because I can't find an example of passing a 2d array by reference in my book yet. But I tried:
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    void initArray();
    void selectionSort(char names[20][17]);
    int searchName(char names[20][17]);
    int binarySearch(char array[1][17], char names[20][17]);
    
    
    int main()
    {
    initArray();
    }
    
    void initArray()
    {
    		const int NUM_NAMES= 20, SIZE = 17;
    		char names[NUM_NAMES][SIZE]= {"Collins, Bill", "Smith, Bart", "Allen, Jim", 
    									  "Griffin, Jim", "Stamey, Marty", "Rose, Geri",
    									  "Taylor, Terri", "Johnson, Jill", 
    									  "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", 
    									  "James, Jean", "Weaver, Jim", "Pore, Bob", 
    									  "Rutherford, Greg", "Javens, Renee", 
    									  "Harrison, Rose", "Setzer, Cathy", 
    									  "Pike, Gordon", "Holland, Beth"};
    		
    		selectionSort(names[20][17]); 
    		
    }
    void selectionSort(char names[20][17])
    		{
    
    			int number, startScan[81], minIndex[81], elems;
    			elems = 17;
    			char minValue[1][17];
    			for (number = 0; number < (elems - 1); number++)
    				{
    				minIndex[81] = number;
    				strcpy(minValue[17], names[17]);
    				for (int index = number+1; index < elems; index++)
    				{
    
    					if (strcmp(names[number], minValue[81]) != 0)
    					{
    					strcpy(minValue[81], names[number]);
    					minIndex[81] = index;
    					}
    					strcpy(names[index], names[number]);
    					strcpy(names[number], minValue[17]);
    				} 
    		
    		}
     searchName(names[20][17]);
    }
    int searchName(char names[20][17])
    {
    	char name[1][17];
    	int position;
    			
    	cout << "Please enter a name putting the last name first.\n";
    	cin >> name[0][17];
    	binarySearch(name[20][17], names[20][17]);
        cout << name << " was found here: " << position << "\n";
    	exit(0);
    	return position;
    }
    int binarySearch(char name[20][17], char names[20][17])
    {
    
    int elems = 17,
    first = 0,
    last = elems - 1,
    middle,
    position = -1;
    bool found = false;
    
    while (!found && first <= last)
    	{
    	middle = (first + last)/2;
    	if(strcmp(names[middle], name[20][17]) == 0)
    	{
    		found = true;
    		position = middle;
    	}
    	else if 
    		(strcmp(names[middle], name[20][17]) <= 1)
    		last = middle - 1;
    	else
    		first = middle +1;
    }
    return position; 
    }
    More errors about conversion:
    Code:
    binarystringsearch.cpp(28) : error C2664: 'selectionSort' : cannot convert parameter 1 from 'char' to 'char [][17]'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(54) : error C2664: 'searchName' : cannot convert parameter 1 from 'char' to 'char [][17]'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(63) : error C2664: 'binarySearch' : cannot convert parameter 1 from 'char' to 'char [][17]'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(81) : error C2664: 'strcmp' : cannot convert parameter 2 from 'char' to 'const char *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(87) : error C2664: 'strcmp' : cannot convert parameter 2 from 'char' to 'const char *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

  8. #8
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    You don't always need the brackets when referring to an array. When you pass the array, just use the name of the array:
    Code:
    selectionSort(names);
    Also, remember when you pass by reference to use & in the function prototype and definition.

    Also, the point of the const ints is so that you don't put [20][17] all over. What if you change the dimensions of the array? Instead of changing all of the 20s to 35s or 40s or whatever, you can just change NUM_NAMES.
    There is a difference between tedious and difficult.

  9. #9
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    When I put the & in the prototype and definition, I get the following error:
    Code:
    error C2234: 'names' : arrays of references are illegal
    also I tried using [NUM_NAMES][SIZE] instead of [20][17] and I get this:
    Code:
    error C2065: 'NUM_NAMES' : undeclared identifier
    c:\documents and settings\kaziz\my documents\visual studio 2005\projects\7aziz\7aziz\binarystringsearch.cpp(31) : error C2065: 'SIZE' : undeclared identifier
    I cannot put these variables in the main function so I don't know how to make sure that their scope is all the functions.

  10. #10
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    Here is what I have now:
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    void initArray();
    void selectionSort(char &names[20][17]);
    int searchName(char &names[20][17]);
    int binarySearch(char array[1][17], char &names[20][17]);
    
    
    int main()
    {
    initArray();
    }
    
    void initArray()
    {
    		const int NUM_NAMES= 20, SIZE = 17;
    		char names[NUM_NAMES][SIZE]= {"Collins, Bill", "Smith, Bart", "Allen, Jim", 
    									  "Griffin, Jim", "Stamey, Marty", "Rose, Geri",
    									  "Taylor, Terri", "Johnson, Jill", 
    									  "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", 
    									  "James, Jean", "Weaver, Jim", "Pore, Bob", 
    									  "Rutherford, Greg", "Javens, Renee", 
    									  "Harrison, Rose", "Setzer, Cathy", 
    									  "Pike, Gordon", "Holland, Beth"};
    		
    		selectionSort(names); 
    		
    }
    void selectionSort(char &names[NUM_NAMES][SIZE])
    		{
    
    			int number, startScan[81], minIndex[81], elems;
    			elems = 17;
    			char minValue[1][17];
    			for (number = 0; number < (elems - 1); number++)
    				{
    				minIndex[81] = number;
    				strcpy(minValue[17], names[17]);
    				for (int index = number+1; index < elems; index++)
    				{
    
    					if (strcmp(names[number], minValue[81]) != 0)
    					{
    					strcpy(minValue[81], names[number]);
    					minIndex[81] = index;
    					}
    					strcpy(names[index], names[number]);
    					strcpy(names[number], minValue[17]);
    				} 
    		
    		}
     searchName(names[NUM_NAMES][SIZE]);
    }
    int searchName(char &names[NUM_NAMES][SIZE])
    {
    	char name[1][17];
    	int position;
    			
    	cout << "Please enter a name putting the last name first.\n";
    	cin >> name[0][17];
    	binarySearch(name[20][17], names[NUM_NAMES][SIZE]);
        cout << name << " was found here: " << position << "\n";
    	exit(0);
    	return position;
    }
    int binarySearch(char name[20][17], char &names[NUM_NAMES][SIZE])
    {
    
    int elems = 17,
    first = 0,
    last = elems - 1,
    middle,
    position = -1;
    bool found = false;
    
    while (!found && first <= last)
    	{
    	middle = (first + last)/2;
    	if(strcmp(names[middle], name[20][17]) == 0)
    	{
    		found = true;
    		position = middle;
    	}
    	else if 
    		(strcmp(names[middle], name[20][17]) <= 1)
    		last = middle - 1;
    	else
    		first = middle +1;
    }
    return position; 
    }
    here are my errors:
    Code:
    binarystringsearch.cpp(6) : error C2234: 'names' : arrays of references are illegal
    
    binarystringsearch.cpp(7) : error C2234: 'names' : arrays of references are illegal
    
    binarystringsearch.cpp(8) : error C2234: 'names' : arrays of references are illegal
    
    binarystringsearch.cpp(28) : error C2664: 'selectionSort' : cannot convert parameter 1 from 'char [20][17]' to 'char *[][17]'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(31) : error C2065: 'NUM_NAMES' : undeclared identifier
    
    binarystringsearch.cpp(31) : error C2065: 'SIZE' : undeclared identifier
    
    binarystringsearch.cpp(31) : error C2234: 'names' : arrays of references are illegal
    
    binarystringsearch.cpp(40) : error C2664: 'strcpy' : cannot convert parameter 2 from 'char *[1]' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(44) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char *[1]' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(46) : error C2664: 'strcpy' : cannot convert parameter 2 from 'char *[1]' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(49) : error C2664: 'strcpy' : cannot convert parameter 1 from 'char *[1]' to 'char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(50) : error C2664: 'strcpy' : cannot convert parameter 1 from 'char *[1]' to 'char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(56) : error C2234: 'names' : arrays of references are illegal
    
    binarystringsearch.cpp(63) : error C2664: 'binarySearch' : cannot convert parameter 1 from 'char' to 'char [][17]'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(68) : error C2234: 'names' : arrays of references are illegal
    
    binarystringsearch.cpp(81) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char *[1]' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    
    binarystringsearch.cpp(87) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char *[1]' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

  11. #11
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    This is what happens why you try to help in a hurry. I tried to squeeze in some pointers while I could, and gave you incorrect information. You have my most sincere apologies.

    Arrays are always passed by reference, but you don't specify it as such. You just pass the array, and although it looks like you're passing by value, all you're really passing in the address of the array (just like a reference). So, you can take out the &s. My fault, again, I apologize. Changing NUM_NAMES and SIZE is part of the solution, you also have to pass those along to the functions so those variables are valid within each function's scope.

    Now that I'm finally at home, with a compiler at hand, I'm going to take another (much harder) look at your code. I'll post some better fixes and examples as soon as I can.

    Again, I'm very sorry to have steered you wrong yesterday.

    p.s. It's for times like this, and for so many other reasons, that I hate arrays.
    There is a difference between tedious and difficult.

  12. #12
    Moderately Rabid Decrypt's Avatar
    Join Date
    Feb 2005
    Location
    Milwaukee, WI, USA
    Posts
    300
    First, arrays. Arrays are referred to by name if you want the entire array (where applicable), or by name and brackets if you are referring to a single element.
    Code:
    char yourname[8] = "Kristen";
    defines a char array, 8 elements big. Each index (0 to 7) refers to a single character. yourname[0] = 'K', yourname[2] = 'i' etc.
    So when you want to pass an entire array, do it with the whole name. When you want to pass a single element of that array, use the index to indicate which one. To call your selectionSort, which takes an array of char, it goes (provided names is declared correctly):
    Code:
    selectionSort(names);
    but if you had a function that took a char, like this one I just made up:
    Code:
    void printChar(char letter);
    You call that function like this:
    Code:
    printChar(yourname[4])
    because 'names' refers to an array of char, but 'yourname[4]' refers to a character - the 5th character in 'yourname.'

    A lot of other problems in your code stem from this. You use strcpy and strcmp incorrectly, passing chars instead of char arrays for one.

    Also, as I said before, to use NUM_NAMES and SIZE in functions, you'll have to pass them to those functions.

    As far as functions go, let me illustrate the use of arrays:
    Code:
    Prototype:
    void selectionSort(char [][17] names, int NUM_NAMES, int SIZE); //the variable names are optional for all prototypes
    
    Definition
    void selectionSort(char[][17] names, int NUM_NAMES, int SIZE)
    {
       //blah blah blah
    }
    
    Function call: (assuming all variable have been declared)
    selectionSort(names, NUM_NAMES, SIZE);
    Note that when prototyping and defining a function that takes array parameters, you do not need to specify the number of rows, just the columns.

    There are other problems with your code, but this should get you going for awhile. Look over your code, and see where you can apply the basics of arrays. I don't know of a good online tutorial on arrays offhand, but google should probably come up with one. Once you have that down, you can work on the sorting algorithms and the rest of your program. When writing a program like this, with multiple functions, test-compile each function, little by little. It makes compile-time errors easier to find, and can help you better understand what's going on with your code.

    To everyone who read this thread, I apologize again for the incorrect posts.
    There is a difference between tedious and difficult.

  13. #13
    Registered User
    Join Date
    Mar 2006
    Posts
    30
    OK, so I looked around and found a tutorial on arrays and I thought I understood it, so I went back to my code and edited it. Still getting errors.
    Code:
    #include <iostream>
    #include <iomanip>
    using namespace std;
    
    void initArray();
    void selectionSort(char [][17] , int NUM_NAMES, int SIZE); 
    int searchName(char [][17], int NUM_NAMES, int SIZE);
    int binarySearch(char array[][17], char names[][17]);
    
    
    int main()
    {
    initArray();
    }
    
    void initArray()
    {
    		const int NUM_NAMES= 20, SIZE = 17;
    		char names[NUM_NAMES][SIZE]= {"Collins, Bill", "Smith, Bart", "Allen, Jim", 
    									  "Griffin, Jim", "Stamey, Marty", "Rose, Geri",
    									  "Taylor, Terri", "Johnson, Jill", 
    									  "Allison, Jeff", "Looney, Joe", "Wolfe, Bill", 
    									  "James, Jean", "Weaver, Jim", "Pore, Bob", 
    									  "Rutherford, Greg", "Javens, Renee", 
    									  "Harrison, Rose", "Setzer, Cathy", 
    									  "Pike, Gordon", "Holland, Beth"};
    		
    		selectionSort(names, NUM_NAMES, SIZE); 
    		
    }
    void selectionSort(char names[][17] , NUM_NAMES, SIZE)
    		{
    
    			int number, startScan[81], minIndex[81], elems = 17;
    			char minValue[][17];
    			for (number = 0; number < (elems - 1); number++)
    				{
    				minIndex[81] = number;
    				strcpy(minValue[index][17], names[index][17]);
    				for (int index = number+1; index < elems; index++)
    				{
    
    					if (strcmp(names, minValue) != 0)
    						{
    							strcpy(minValue[81], names[81]);
    							minIndex[81] = index;
    						}
    					strcpy(names, names);
    					strcpy(names, minValue);
    				} 
    		
    		}
     searchName(names, NUM_NAMES, SIZE);
    }
    int searchName(char names[20][17])
    {
    	char name[1][17];
    	int position;
    			
    	cout << "Please enter a name putting the last name first.\n";
    	cin >> name[0][17];
    	binarySearch(name, names);
        cout << name << " was found here: " << position << "\n";
    	exit(0);
    	return position;
    }
    int binarySearch(char name[20][17], char names[20][17])
    {
    
    	int elems = 17,
    	first = 0,
    	last = elems - 1,
    	middle,
    	position = -1;
    	bool found = false;
    
    	while (!found && first <= last)
    		{
    		middle = (first + last)/2;
    		if(strcmp(names[middle][elems], name[20][17]) == 0)
    			{
    			found = true;
    			position = middle;
    			}
    		else if 
    			(strcmp(names[index][17], name) <= 1)
    			last = middle - 1;
    		else
    			first = middle +1;
    }
    return position; 
    }
    Errors
    Code:
    binarystringsearch.cpp(31) : error C2061: syntax error : identifier 'NUM_NAMES'
    binarystringsearch.cpp(36) : error C2133: 'minValue' : unknown size
    binarystringsearch.cpp(40) : error C2664: 'strcpy' : cannot convert parameter 1 from 'char [][17]' to 'char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    binarystringsearch.cpp(41) : error C2440: 'initializing' : cannot convert from 'int' to 'int [81]'
            There are no conversions to array types, although there are conversions to references or pointers to arrays
    binarystringsearch.cpp(41) : error C2446: '<' : no conversion from 'int' to 'int *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    binarystringsearch.cpp(41) : error C2040: '<' : 'int [81]' differs in levels of indirection from 'int'
    binarystringsearch.cpp(41) : error C2105: '++' needs l-value
    binarystringsearch.cpp(44) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char [][17]' to 'const char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    binarystringsearch.cpp(47) : error C2440: '=' : cannot convert from 'int [81]' to 'int'
            There is no context in which this conversion is possible
    binarystringsearch.cpp(49) : error C2664: 'strcpy' : cannot convert parameter 1 from 'char [][17]' to 'char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    binarystringsearch.cpp(50) : error C2664: 'strcpy' : cannot convert parameter 1 from 'char [][17]' to 'char *'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    binarystringsearch.cpp(54) : error C2065: 'NUM_NAMES' : undeclared identifier
    binarystringsearch.cpp(54) : error C2065: 'SIZE' : undeclared identifier
    binarystringsearch.cpp(81) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'
            Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
    binarystringsearch.cpp(87) : error C2065: 'index' : undeclared identifier
    By the way, Decrypt, I really want to say that I greatly apreciate the help you have given me, so Thanks a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  2. Replies: 16
    Last Post: 10-29-2006, 05:04 AM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 01:18 AM