This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Mar 31st, 2013  |  syntax: C++  |  size: 0.41 KB  |  views: 42  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int main () {
  7.         const int size = 10;
  8.         int sort[ size ] = { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 };
  9.         int var;
  10.        
  11.         for ( int i = 0; i < size; i++ ) {
  12.                 if ( sort[ i ] > sort[ i + 1 ] ) {
  13.                         var = sort[ i ];
  14.                         sort[ i ] = sort[ i + 1 ];
  15.                         sort[i + 1] = var;
  16.                 }
  17.         }
  18.  
  19.         for ( int x = 0; x < size; x++ ) {
  20.                 cout << sort[ x ];
  21.         }
  22.         system("PAUSE");
  23. }
clone this paste RAW Paste Data