利用c++模板实现快速排序

/* QuickSort.hpp */

#ifndef _QUICK_SORT_H_
#define _QUICK_SORT_H_

template
void QuickSort(T *pInput, int low, int high)
{
	if(low >= high)
	{
		return;
	}
	
	int first = low;
	int last = high;
	int key = pInput[first];

	while(first < last)
	{
		while(first=key)
		{
			--last;
		}
		pInput[first] = pInput[last];
		while(first
/* main.cpp */

#include 
#include "QuickSort.hpp"
using namespace std;

int main()
{
	int i = 0;
	int a[10] = {1,4,7,2,5,8,3,6,9,0};
	
	QuickSort(a,0,9);

	for(i=0; i<10; i++)
	{
		cout<

你可能感兴趣的:(c/c++)