Hey, I'd appreciate if someone would help me modify this code so the descending order can be displayed on the screen , here it is....

#include <iostream>   // ostream
#include <vector>

#define SIZE 10

using namespace std;

int partition(vector<long unsigned int> & a, int start, int end) {
  unsigned int pivot = a[start];
  unsigned int from_left = start+1;
  unsigned int from_right = end;
  unsigned int tmp;

while (from_left != from_right) {
    if (a[from_left]  <= pivot) from_left++;
    else {
      while (( from_left != from_right)  && (pivot < a[from_right])) from_right--;
      tmp =  a[from_right];
      a[from_right] = a[from_left];
      a[from_left] = tmp;
  if (a[from_left]>pivot) from_left--;
  a[start] = a[from_left];
  a[from_left] = pivot;

  return (from_left);

void quickSort(vector <long unsigned int> & a, int p, int r) {
  if (p < r) {
    int q = partition(a, p, r);
    quickSort(a, p, q - 1);
    quickSort(a, q + 1, r);

int main() {  
	int a[SIZE] = {23,43,54,56,77,43,24,97,34,10};

	vector <long unsigned int> V (a,a+SIZE);

  quickSort(V, 0, SIZE-1);

  for( long unsigned int i = 0; i < SIZE; i++){
 return 0;
6 Years
Discussion Span
Last Post by pichi20

pleaseeeeeeeeeee somebody help meee!.. I didnt pass that test and am still confused! I need help ASAP :'(


change the for loop inside main to this :
for( long unsigned int i = SIZE-1; i > 0; i--)


thank uu, sorry for not being that specific. That's what i tried but the professor didn't accept that because he wants the function to do it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.