Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.66 KB | None | 0 0
  1. int main() {
  2.     srand(time(0));
  3.     int N;
  4.     char X;
  5.     FILE* fp = fopen("inlab01.txt", "r");
  6.     if (fp == NULL)
  7.         return -1;
  8.     fscanf(fp, "%d %c", &N, &X);
  9.     fclose(fp);
  10.     ///////
  11.     clock_t begin, end;
  12.     double time_spent;
  13.     begin = clock();
  14.     ///////
  15.  
  16.     struktura ** tab = Losowanie(N);
  17.     Sortowanie(tab, N);
  18.     for (int i = 0; i < 20; i++) {
  19.         printf("%d.\t%d\t%c\t%.2f \n", i + 1, tab[i]->id, tab[i]->znak, tab[i]->liczba);
  20.     }
  21.     Zliczanie(tab, N, X);
  22.     Kasowanie(tab, N);
  23.  
  24.     ///////
  25.     end = clock();
  26.     time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
  27.     printf("\n \n");
  28.     printf("Czas trwania programu: %f", time_spent);
  29.     printf("\n");
  30.  
  31.     getchar();
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement