43 lines
985 B
C
43 lines
985 B
C
#ifndef _COMPARE_H
|
|
#define _COMPARE_H
|
|
|
|
#include <limits.h>
|
|
#include <math.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <strings.h>
|
|
#include <sys/time.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
|
|
// réel aléatoire dans [0,1]
|
|
#define RAND01 ((double)random() / RAND_MAX)
|
|
#define RANDINT(n) (random() % (n))
|
|
|
|
/* compare.c */
|
|
int fcmp_int(const void *x, const void *y);
|
|
int fcmp_reverse_int(const void *x, const void *y);
|
|
int fcmp_char(const void *x, const void *y);
|
|
int fcmp_double(const void *x, const void *y);
|
|
int fcmp_string(const void *x, const void *y);
|
|
int fcmp_string_hiera(const void *x, const void *y);
|
|
int fcmp_pointx(const void *p, const void *q);
|
|
int fcmp_pointy(const void *p, const void *q);
|
|
|
|
// taille max d'une string
|
|
#define MAXSTR 7
|
|
|
|
// type fonction de comparaison
|
|
typedef int (*fcmp)(const void *, const void *);
|
|
|
|
// type chaîne de caractères
|
|
typedef char *string;
|
|
|
|
typedef struct {
|
|
double x, y;
|
|
} point;
|
|
|
|
#endif
|