diff --git a/files/devis.txt b/files/devis.txt new file mode 100644 index 0000000..9d9c56f --- /dev/null +++ b/files/devis.txt @@ -0,0 +1,50 @@ +Plomberie +Pros De L’eau +12, Av. la république – 63000 – Clermont-Ferrand +500000 +35 +25000 +Electricité +Electro Maître +50, zone industrielle sud – 15000 – Aurillac +450000 +60 +42000 +Plomberie +DolcéAqua +33, zone Industriel Aubière – 63170 – Aubière +450000 +40 +27000 +Sols +comusolisme +20, Boulevard Desaix – 63000 – Clermont-Ferrand +70000 +10 +10000 +Structure +Eiffage Construction Auvergne +300000 +40 +20000 +Peinture +Pingeon et Fils +52, Boulevard Lafayette – 63000 – Clermont-Ferrand +5000 +6 +4000 +Fondation +Léon Grosse +5, Rue Louis Blériot – 63000 – Clermont-Ferrand +60000 +42 +7000 +Murs +illiCO travaux +37, bis Avenue Marx Dormoy – 63000 – Clermont-Ferrand +Finitions +SGP finition +4, Rue de Chignat – 63000 – Clermont-Ferrand +100 +10 +5000 diff --git a/files/précédences.txt b/files/précédences.txt new file mode 100644 index 0000000..56cf03a --- /dev/null +++ b/files/précédences.txt @@ -0,0 +1,10 @@ +Fondation Structure +Structure Electricite +Structure Plomberie +Plomberie Murs +Electricite Menuiserie +Plomberie Sols +Murs Peinture +Peinture Finitions +Sols Finitions + diff --git a/srcs/atomes.c b/srcs/atomes.c new file mode 100644 index 0000000..1a56f93 --- /dev/null +++ b/srcs/atomes.c @@ -0,0 +1,86 @@ +#include "../includes/" + +void fusion(int R[], int tR, int S[], int tS, int T[]) +{ + int i; + int j; + int k; + int tlog; + + i = 0; + j = 0; + tlog = tR + tS; + while (i < tR && j <= tS) + { + if (R[i] < S[j]) + { + T[k] = R[i]; + i++; + } + else + { + T[k] = S[j]; + j++; + } + k++; + } + while (i < tR) + { + T[k] = R[i]; + i++; + k++; + } + while (j < tS) + { + T[k] = S[j]; + j++; + k++; + } +} + +void copy(int T[], int i, int j, int R[]) +{ + int k; + + k = 0; + while (i < j) + { + R[k] = T[i]; + i++; + k++; + } +} + +void triFusion(int T[], int tlog) +{ + int *R; + int *S; + + if (tlog == 1) + return; + R = (int *)malloc(sizeof (int) * (tlog / 2)); + S = (int *)malloc(sizeof (int) * tlog - tlog/2); + if (!R || !S) + exit (1); + copy (T, 0, tlog/2, R); + copy (T, tlog/2, tlog, S); + triFusion (R, tlog/2); + triFusion (S, tlog - tlog/2); + fusion (R, tlog/2, S, tlog - tlog/2, T); + free (R); + free (S); +} + + +int main (void) +{ + int tab[10] = {10, 0, 2, 15, 7, 5 ,68, 1, 7 ,8}; + int tlog = 10; + int i = 0; + + triFusion(tab, tlog); + while (i < tlog) + printf ("%d : ", tab[i++]); + printf ("\n"); + return (0); +}