帮我看看这个排序问题吧
我用G++编译能通过但是运行程序出现错误,好象是数组益处,我主要是想实现从TXT文件中读取整数并从小到大排序.文件格式如下(其中整数个数和数本身都是随机的,每个整数用 ", "分隔):
1,9,2,-10,0,-4
输出要求是:
-10,-4,0,1,2,9
#include <iostream>
#incldue <string>
#include <fstream>
using namespace std;
const int INTEGER_NUMBER =10;
const int STRING_LENGHT =127;
const int SINGLE_NUMBER_LENGHT=10;
void QuickSort(int R[],int low,int high);
int Partition(int R[],int low ,int high);
int Partition(int R[],int i,int j)
{
int pivot = R[i];
while(i <j)
{
while(i < j&&R[j]> =pivot)
{
j--;
}
if(i < j)
{
R[i++]=R[j];
}
while(i < j && R[i] <=pivot)
{
i++;
}
if(i < j)
{
R[j--] = R[i];
}
}
R[i] = pivot;
return i;
}
void QuickSort(int R[],int low,int high)
{
int pivotpos;
int nCount = 0;
nCount++;
if(nCount == 1 || nCount == 3 || nCount ==4)
{
for(int i =0;i <INTEGER_NUMBER;i++)
{
cout < < R[i] < < " ";
cout < < endl;
}
}
if(low < high)
{
pivotpos = Partition(R,low,high);
&