constint size = 3;
int array[size];
int n, i, j;
/* Fill the array */
cout<<"Enter "<<size<<" random numbers"<<endl;
cout.flush();
for ( n = 0; n < size; n++ ) {
cin >> array[n];
if( !cin.good() )
break;
}
//insertion
for ( i = 1; i < n; i++ ) {
int save = array[i];
for ( j = i - 1; j >= 0 && array[j] > save; j-- )
array[j + 1] = array[j];
array[j + 1] = save;
}
/* Print the sorted array */
for ( i = 0; i < n; i++ ){
cout<<array[i];
cout<<endl;
}
right now you can see that i am using insertion and i am printing the array in ascending order, how to print to descending order? i tried cout<<array[size - i]l but that give me a strange error.