I have this program that generates random numbers which works but now I need to add a program that will perform a buble sort and I can't get the two programs to be compatible.
#define size 100
void main( void )
/* This portion of the program seeds the random-number generator
* with the time, then puts 100 random integers into numarray.
* Seed the random-number generator with current time so that
* the numbers will be different every time we run.
srand( (unsigned)time( NULL ) );
/* Display 100 numbers. */
for( i = 0; i < size;i++ )
numarray[i]=rand(); /* the “rand()” is the function that random generates numbers. I have it set to do 100 for test purposes. Once I am sure my sort routines routines works, I will set it to something like 100,000. I got this code from the help library of the C++ application I am using.*/
cout << numarray[i] << "\t";
The above program works and here is what I am trying to add to do a bubble sort:
for (a = 1; a < numarray[size]; a++)
for (b = numarray[size] - 1; b >= a; B--)
if (Vektor[b-1] > Vektor[b])
Why will it not work?