Advertisement
rengetsu

ProcedurProgramavimas_3.07

May 2nd, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <time.h>
  4. #include <stdlib.h>
  5.  
  6. using namespace std;
  7.  
  8. void SpausdintiRezultatus(int zzz, int xxx[10000])
  9. {
  10.     for(int s=0; s<zzz; s++)
  11.             cout<<xxx[s]<<endl;
  12. }
  13.  
  14. void SurikiuotiElementus(int zz, int xx[10000])
  15. {
  16.     int buf;
  17.     for(int j=0;j<zz;j++){
  18.         for(int i=0;i<zz-1;i++){
  19.             if(xx[i]<xx[i+1]){
  20.                 buf=xx[i];
  21.                 xx[i]=xx[i+1];
  22.                 xx[i+1]=buf;
  23.             }
  24.         }
  25.     }
  26.     SpausdintiRezultatus(zz,xx);
  27. }
  28.  
  29. void NuskaitytiSeka()
  30. {
  31.     int z, x[10000];;
  32.     cin>>z;
  33.     for(int i=0; i<z; i++)
  34.     {
  35.         cin>>x[i];
  36.     }
  37.     SurikiuotiElementus(z,x);
  38. }
  39.  
  40. void main()
  41. {  
  42.     NuskaitytiSeka();
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement