Hey all, back once again. I've got some more code that i need some help with. Thanks to Aia for his help as well. Anywho this time I've still got the fifty random integers and now I'm working on sorts. I've managed to complete the bubblesort portion of the book but the Qsort is still giving me a bit of an issue. Basically i need to take what i have, print the fifty randoms, sort them and then print them once sorted. Any help as usual would be greatly appreciated.

#include <stdio.h>
      #include <stdlib.h>
      #include <time.h>
      int main( void )
      {
      int fifty[50];
      int i;
      srand( (unsigned ) time( NULL ) );
      for( i = 0 ; i < 50; i++ )
      {
      fifty[i] = rand();
      }
      for( i = 0; i < 50; i++ )
      {
      printf( "%d\n", fifty[i] );
      }
      getchar();
      return 0;
      }

Thank you for not reading the "how to post code" thread at the top of the forum, and generally ignoring the watermark at the back of the edit window :icon_rolleyes:

Hey all, back once again. I've got some more code that i need some help with. Thanks to Aia for his help as well. Anywho this time I've still got the fifty random integers and now I'm working on sorts. I've managed to complete the bubblesort portion of the book but the Qsort is still giving me a bit of an issue. Basically i need to take what i have, print the fifty randoms, sort them and then print them once sorted. Any help as usual would be greatly appreciated.

  #include <stdio.h>
  #include <stdlib.h>
  #include <time.h>
  int main( void )
  {
  int fifty[50];
  int i;
  srand( (unsigned ) time( NULL ) );
  for( i = 0 ; i < 50; i++ )
  {
  fifty[i] = rand();
  }
  for( i = 0; i < 50; i++ )
  {
  printf( "%d\n", fifty[i] );
  }
  getchar();
  return 0;
  }

Edited 3 Years Ago by mike_2000_17: Fixed formatting

my bad man, didn't realize it was such a big deal, no need to be hostile. sorry.

my bad man, didn't realize it was such a big deal, no need to be hostile. sorry.

Next code you post do the same thing you did last, but write (code=c)
instead of (code). That would set the proper formatting for c code.

You posted the same code that I gave you as an example. You haven't done anything to it. You are asking for help about Qsort.
Please, post any tries that you have done by yourself using that type of sorting. Then, it is more likely that someone will help you.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

Oops. This post was just a botch in general, but I ended up just having my compare function written incorrectly. Thanks for the input though.

This question has already been answered. Start a new discussion instead.