yea, I did that so you could see that is changes and that is always working.
You could use if(GetAsyncKeyState(VK_ESCAPE)) to exit when you want to. Just add this in the while loop and press and hold the escape key and make it so when you do so it exits.
BTW is this for collage? When I'm out of middle school and high school I'm going to collage to learn C++, C#, and Java.
/*Write a program that generates 50 random numbers between 1 and 100. Sort the
numbers into ascending order. Then, sort the numbers into descending order.
Your output should consist of first, the list of 50 random numbers, next, the
sorted list in ascending order, and finally, the sorted list in descending
order. Use a bubble sort or insertion sort.*/
int n = 50;
void Bubblesort(int array, int n)
int tmp, j, q;
for (q=0; q < n-1; q++)
for (j=0; j < n-1; j++)
if (array[j] < array[j+1])// changes acending to decending
tmp = array[j];
array[j] = array[j+1];
array[j+1] = tmp;
for (int j = 0; j < n; j++)
i = rand() % 101;
array[j] = i;
for (int k = 0; k < n; k++)
cout << array[k] << " ";
cout << endl << endl;
for (int i=0; i < n; i++)
cout << array[i] << " " ;
cout << endl;