Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Oct 12th, 2018 54 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. void sort_array(int *arr)
  6. {
  7.     for(int i = 0; i < 5; ++i)
  8.         arr[i]++;
  9.        
  10.     for(int i = 1; i < 5; ++i)
  11.     {
  12.         for(int r = 0; r < 5 - i; r++)
  13.         {
  14.             if(arr[r] < arr[r+1])
  15.             {
  16.                 int temp = arr[r];
  17.                 arr[r] = arr[r+1];
  18.                 arr[r+1] = temp;
  19.             }
  20.         }
  21.     }
  22. }
  23.  
  24. int main()
  25. {
  26.     int array[5];
  27.    
  28.     for(int i = 0; i < 5; ++i)
  29.         cin >> array[i];
  30.    
  31.     sort_array(array);
  32.    
  33.     for(int i = 0; i < sizeof(array) / sizeof(array[0]); ++i)
  34.         cout << "array  - pos - " << i << " " << array[i] << endl;
  35.        
  36.     return 0;
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top