Ok i am having alittle problem with my code, I am getting 4 errors for having these things unidetitfied but they are so I dont know what is is here is the code that I have so far. The object is to have counters that will count how many comparisions and how many swaps are being made.

#include <iostream.h>
#include <stdlib.h>
#include <cstddef>



typedef int Select;


void selectionsort(Select theArray[], int n)
{
	 n = 5;
	for (int last = n-1; last >= 1; --last)
	{
		int largest = indexoflargest(theArray, last + 1);
		swap(theArray[largest], theArray[last]);
	}
}

int indexoflargest(const Select theArray[], int size)
{
	int indexsofar = 0;
	for (int currentindex = 1; currentindex < size; ++currentindex)
	{
		if(theArray[currentindex] > theArray[indexsofar])
			indexsofar = currentindex;
	}
	return indexsofar;
}
void swap(Select& x, Select& y)
{
	Select temp = x;
	x = y;
	y = temp;
}

Prototypes of functions are missing and change the name of swap function as it is already defined funtion

Prototypes of functions are missing and change the name of swap function as it is already defined funtion

Argh the questions in here...
Post error reports for crist sake...
btw lol, (real reason for posting) 200+ post and still a junior poster, does not sound right ;)

200+ post and still a junior poster, does not sound right ;)

Site undergone a big design change recently....earlier many many memebrs including me had a title of posting whiz...which got changed to junior poster....earlier anyone with 100+ posts was posting whiz....now i think its much more than that....i guess site is trying to raise the standards...doesn't matter much to me....i am here to learn and help...not in chase of any titles....there was a thread regarding this in geek lounge recently...if u want u can take a look at it

Hehe, ok

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.