SHARE
TWEET

Untitled

Matrxi999 Jan 19th, 2020 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #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 = N-1; i>0; i--)
  9.     {
  10.         for (int j = 0; j < i; j++)
  11.         if (a[j] > a[j+1])
  12.     {
  13.         char schowek = a[j];
  14.         a[j] = a[j+1];
  15.         a[j+1] = schowek;
  16.     }
  17.  
  18.     //Wypisanie tablicy po każdym kroku
  19.     //| - początek posortowanych
  20.     {
  21.         cout << "i=" << i << ": ";
  22.         for(int k=0; k<N; k++)
  23.         cout << " " << a[k] << " " << (k==i-1?"|":" ") ;
  24.         cout << endl;
  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