SHARE
TWEET

Untitled

Matrxi999 Jan 19th, 2020 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. z#include <iostream>
  2. using namespace std;
  3. //...
  4. {
  5.     const int N=7;
  6.     char a[N] = {'D','A','C','B','E','G','F'};
  7.  
  8.     for (int i = 0; i< N-1; i++)
  9.     {
  10.         int i_min = i;
  11.         for (int j = i+1; j < N; j++)
  12.             if (a[j] < a[i_min]) i_min = j;
  13.  
  14.         char schowek= a[i];
  15.         a[i] = a[i_min];   
  16.         a[i_min] = schowek;
  17.  
  18.         //Wypisanie tablicy po każdym kroku
  19.         // ! - i_min, | - koniec posortowanych
  20.         {
  21.             cout << "i=" << i << ": ";
  22.             for(int k=0; k<N; k++)
  23.                 cout << " " << a[k] << (k==i_min?"!":" ") << (k==i?"|":" ") ;
  24.             cout <<
  25.         }
  26.     }
  27. }
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