uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

main.c (620B)


      1 #include "fcombinations.h"
      2 
      3 int main(int argc, char **argv)
      4 {
      5     int *arr, N, x1, x2, y1, y2;
      6     FILE *dataFile = fopen(*(argv + 1), "r");
      7 
      8     if (dataFile == NULL)
      9     {
     10         set_color(BOLD_RED);
     11         printf("Error! Not enough memory, exiting...\n");
     12         exit(EXIT_FAILURE);
     13         set_color(STANDARD);
     14     }
     15     else
     16     {
     17         N = get_n(dataFile);
     18         arr = fill_array(N, dataFile);
     19         quicksort(arr, 0, N-1);
     20         x_pair(&x1, &x2, dataFile);
     21         y_pair(&y1, &y2, dataFile);
     22         print_combs(arr, N, x1, x2, y1, y2);
     23     }
     24 
     25     fclose(dataFile);
     26     free(arr);
     27    
     28     return 0;
     29 }