Facebook
From Botched Monkey, 7 Years ago, written in C++.
This paste is a reply to Re: asdfasdf from Abrupt Partdridge - view diff
Embed
Download Paste or View Raw
Hits: 412
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.        
  9.         int A[100]={10,20,30,40,50,60,70,80,90,100,9,19,29,39,49,59,69,79,89,99,8,18,28,38,48,58,68,78,88,98,7,17,27,37,47,57,67,77,87,97,6,16,26,36,46,56,66,76,86,96,5,15,25,35,45,55,65,75,85,95,4,14,24,34,44,54,64,74,84,94,3,13,23,33,43,53,63,73,83,93,2,12,22,32,42,52,62,72,82,92,1,11,21,31,41,51,61,71,81,91};
  10.         int klucz=A[0];
  11.         int w=1;
  12.         for(int i=0;i<=99;i++)
  13.         {
  14.         if(A[i]<klucz)
  15.         swap(A[w],A[i]);       
  16.         w=w+1;
  17.         }
  18.        
  19.         for(int i=0;i<100;i++)
  20.                 cout<<A[i]<<",";
  21.                 cout<<w<<endl;
  22.                
  23.        
  24.  
  25.  return 0;
  26. }
  27.