Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 20th, 2010 | Syntax: C | Size: 0.72 KB | Hits: 61 | Expires: Never
Copy text to clipboard
  1. include <stdio.h>
  2.  
  3. char myid[]= "Balogh Tamás,1MI,18,Sz1R <bata16@gmail.com> NRE9DI\n";
  4. char mytask[]= "Feladat = 8 ISO 8859-2\n";
  5.  
  6.  
  7.  
  8.  
  9. int csok(const void *a,const void *b)
  10. {
  11.         if(*(double*)a<*(double*)b) return 1;
  12.         if(*(double*)a>*(double*)b) return -1;
  13.         return 0;
  14.        
  15. }
  16.  
  17. void rendez(double t[], int n)
  18. {
  19.      qsort(t,n,sizeof(double),csok);
  20.  
  21. }
  22.  
  23.  
  24. int main(void)
  25. {
  26.  
  27.     double tomb[477];
  28.         int i;
  29.     setbuf(stdout, NULL);
  30.  
  31.     printf(myid);
  32.     printf(mytask);
  33.  
  34.         for(i=0;i<477;i++);
  35.         {
  36.                 scanf("%lf",&tomb[i]);
  37.         }
  38.  
  39.  
  40.         rendez(tomb,477);
  41.  
  42.         printf("%lf\n",tomb[23]);
  43.         printf("%lf\n",tomb[32]);
  44.         printf("%lf\n",tomb[94]);
  45.         printf("%lf\n",tomb[93]);
  46.         printf("%lf\n",tomb[427]);
  47.        
  48.  
  49.  
  50.  
  51.  
  52.  
  53.         return 0;