im so sorry , i posted the another code i wrote for the same thing
im a dummy
Code:
#include <stdio.h>
#include <conio.h>
#include <iostream>
void quicksort(float a[],int i,int j)
{
bool ok=true;
int temp=0;
for (int count1=i;count1<j+1;count1++)
{
if (a[count1]>a[count1+1])
{
ok=false;
}
}
if (ok) {return ;};
for (int count2=i;count2<j+1;count2++)
{
if (a[count2]>a[count2+1])
{
temp=a[count2];
a[count2]=a[count2+1];
a[count2+1]=temp;
}
}
float *pp=&a[0];
quicksort(pp,i,j);
}
int main(int argc, char *argv[])
{
float marks[10];
int no;
cout<<"How many marks you have ? (MAX 10) ";
cin>>no;
for (int g=0;g<no;g++)
{
cout<<endl<<"enter mark no "<< (g+1)<<" " ;
cin>>marks[g];
}
int s,f;
cout<<"\nEnter the initial index you want to begin the sort from ";
cin>>s;
cout<<"\nEnter the finish index you want to stop the sort at ";
cin>>f;
float *p=&marks[0];
quicksort(p,s-1,f-1);
for (int l=0;l<no;l++)
{
cout<<" "<<marks[l]<<" ";
}
getche();
return 0;
}
thats my code
try to enter 5 no for examples (2,300,123,2000,4100)
sorry for this mistake
and thanks PJYelton for the reply