求牛人帮忙改下C++程序

来源:百度知道 编辑:UC知道 时间:2024/06/27 15:41:04
#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;

void swap(int &a,int &b)
{
int c;
c=a;
a=b;
b=c;
}
int Partition(int data[],int low,int high)
{
int pivokey;
pivokey = data[low];
while( low<high)
{
while( low<high&&data[high]>=pivokey)
high--;
swap( data[low],data[high]);
while( low<high&&data[low]<=pivokey)
low++;
swap( data[low],data[high]);
}
return low;
}

void QuickSort(int data[],int low,int high)
{
if(low<high)
{
int pivokey = Partition( data,low,high);
QuickSort( data,low,pivokey-1);
QuickSort( data,pivokey+1,high);
}
}

void main()

{
int i;
int j;
int c;
int mydata[100]

cout<<"before ascending order:";
for(i=0;i<1

// dfgfdgfdg.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;

void swap(int &a,int &b)
{
int c;
c=a;
a=b;
b=c;
}
int Partition(int data[],int low,int high)
{
int pivokey;
pivokey = data[low];
while( low<high)
{
while( low<high&&data[high]>=pivokey)
high--;
swap( data[low],data[high]);
while( low<high&&data[low]<=pivokey)
low++;
swap( data[low],data[high]);
}
return low;
}

void QuickSort(int data[],int low,int high)
{
if(low<high)
{
int pivokey = Partition( data,low,high);
QuickSort( data,low,pivokey-1);
QuickSort( data,pivokey+1,high);
}
}

void main()

{
int i;
int j;
int c;
in