| 1 | #include "utils.h" |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | void printarr(int a[], int n) { |
| 6 | for (int i = 0; i < n; i++) { |
| 7 | printf(COLOR_BOLD "%d " COLOR_OFF, a[i]); |
| 8 | } |
| 9 | } |
| 10 | |
| 11 | |
| 12 | void swap(int a[], int i, int j) { |
| 13 | int tmp = a[i]; |
| 14 | a[i] = a[j]; |
| 15 | a[j] = tmp; |
| 16 | } |
| 17 | |
| 18 | |
| 19 | void clearscreen(void) { |
| 20 | #ifdef _WIN32 |
| 21 | system("cls"); |
| 22 | #elif defined(unix) || defined(__unix__) || defined(__unix) || \ |
| 23 | (defined(__APPLE__) && defined(__MACH__)) |
| 24 | system("clear"); |
| 25 | #else |
| 26 | #error "OS not supported." |
| 27 | #endif |
| 28 | } |
| 29 | |