commit aceb7ebdb8b96024898b4cf80cf081f47e04fcb9 Author: Ninjdai Date: Tue Oct 22 13:03:17 2024 +0200 Initial commit diff --git a/TP1/part_1.c b/TP1/part_1.c new file mode 100644 index 0000000..40f3c45 --- /dev/null +++ b/TP1/part_1.c @@ -0,0 +1,131 @@ +#include +#include +#include + +#define TAB_SIZE 7 + +void afficheTab(int tab[], int size); +int* fibonacci(int n); +void print_sizes(); +void exercice_4(); +int est_permutation(int* tab, int n); +int * permutation(int n); +char * appliquer_permutation(char * T, int * permutation, int n); + +int main(int argc, char *argv[]) +{ + /*int i; + + int *tab = fibonacci(TAB_SIZE); + int * tabptr = tab; + + afficheTab(tab, TAB_SIZE); + printf("\n\n"); + */ + //print_sizes(); + //exercice_4(); + + // int tab[8] = {0, 1, 2, 3, 4, 5, 6, 7}; + // printf("%d\n", est_permutation(tab, 8)); + + /*int * tab = permutation(TAB_SIZE); + afficheTab(tab, TAB_SIZE); + char bliat[TAB_SIZE] = "Bonjour"; + + char * bliat_perm = appliquer_permutation(bliat, tab, TAB_SIZE); + for (int i=0; i +#include +#include + +#define NB_LIGNES 9 +#define NB_COLONNES 3 + +float ** tableau(int n, int m); +void autofill_tableau(float** tab, int n, int m); +void autofill_tableau_int(float** tab, int n, int m, int v); +void fill_tableau(float** tab, int n, int m); +void print_tableau(float** tab, int n, int m); +void print_tableau_int(float** tab, int n, int m); +float ** right_rot(float** tab, int n, int m); + +/* +* Libère le tableau +* n: nombre de lignes du tableau +*/ +void free_tab(float** tab, int n); + +float ** triangle_pascal(int size); + +#define PASCAL 5 + +int main(int argc, char *argv[]) { + srand(time(NULL)); + + float ** tab = tableau(NB_LIGNES, NB_COLONNES); + autofill_tableau(tab, NB_LIGNES, NB_COLONNES); + //fill_tableau(tab, NB_LIGNES, NB_COLONNES); + print_tableau(tab, NB_LIGNES, NB_COLONNES); + + printf("\n\n"); + + float ** rot_tab = right_rot(tab, NB_LIGNES, NB_COLONNES); + print_tableau(rot_tab, NB_COLONNES, NB_LIGNES); + + free_tab(tab, NB_LIGNES); + free_tab(rot_tab, NB_COLONNES); + /*float ** t = triangle_pascal(PASCAL); + print_tableau_int(t, PASCAL, PASCAL);*/ + return 0; +} + +float ** triangle_pascal(int size) { + int i,j; + float ** tr = tableau(size, size); + autofill_tableau_int(tr, size, size, 0); + + tr[0][0] = 1; + for (i=1; i +#include +#include + +Liste * create_list() { + Liste * list = malloc(sizeof(Liste)); + list->nb_elements_ = 0; + return list; +} + +int list_length(Liste list) { + return list.nb_elements_; +} + +void append(Liste * list, int val) { + Element * el = malloc(sizeof(Element)); + el->val_ = val; + el->prev_ = list->tail_; + + if (list->tail_ != NULL) { + list->tail_->next_ = el; + } + list->tail_ = el; + list->nb_elements_ += 1; + if (list->nb_elements_==1) { + list->head_ = el; + } +} + +void append_head(Liste * list, int val) { + Element * el = malloc(sizeof(Element)); + + list->head_->prev_ = el; + list->head_ = el; + list->nb_elements_ += 1; +} + +int first_value(Liste * list) { + return list->head_->val_; +} + +int last_value(Liste * list) { + return list->tail_->val_; +} + +void print_list(Liste * list) { + if (list->head_ == NULL) { + printf("[]\n"); + return; + } + Element* current_el = list->head_; + printf("["); + printf("%lu", (unsigned long)current_el); + while (current_el != NULL) { + printf("%d, ", current_el->val_); + current_el = current_el->next_; + } + printf("]\n"); +} + +int main(int argc, char *argv[]) +{ + Liste * list = create_list(); + + append(list, 69); + + print_list(list); + return 0; +} diff --git a/TP1/part_3.h b/TP1/part_3.h new file mode 100644 index 0000000..13e223e --- /dev/null +++ b/TP1/part_3.h @@ -0,0 +1,24 @@ + +typedef struct LListe Liste ; +typedef struct LElement Element ; + +struct LListe{ + int nb_elements_ ; + Element * head_ ; + Element * tail_ ; +} ; + +struct LElement{ + /** + * Element suivant / NULL si dernier element + */ + Element * next_ ; + /** + * Element pr´ec´edente + */ + Element * prev_ ; + /** + * Valeur stock´ee dans la cellule. + */ + int val_ ; +}; diff --git a/TP2/part_1/concatenate b/TP2/part_1/concatenate new file mode 100755 index 0000000..b6001a1 Binary files /dev/null and b/TP2/part_1/concatenate differ diff --git a/TP2/part_1/concatenate.c b/TP2/part_1/concatenate.c new file mode 100644 index 0000000..e79716c --- /dev/null +++ b/TP2/part_1/concatenate.c @@ -0,0 +1,34 @@ +#include +#include + +int main(int argc, char *argv[]) { + if (argc != 3) { + printf("Usage: copy \n"); + exit(-1); + } + + FILE * ogf = fopen(argv[1], "r"); + if (ogf==NULL) { + perror("Error while opening file1"); + } + + FILE * tf = fopen(argv[2], "a+"); + if (tf==NULL) { + perror("Error while opening file2"); + } + + fseek(ogf, 0, SEEK_END); + int ogf_size = ftell(ogf); + fseek(ogf, 0, SEEK_SET); + + char * f = malloc(sizeof(char) * ogf_size); + fread(f, sizeof(char), ogf_size, ogf); + + fwrite(f, sizeof(char), ogf_size, tf); + + fclose(ogf); + fclose(tf); + + return 0; +} + diff --git a/TP2/part_1/copied.log b/TP2/part_1/copied.log new file mode 100644 index 0000000..dabadf2 --- /dev/null +++ b/TP2/part_1/copied.log @@ -0,0 +1,2 @@ +UwU +Sussy Baka :3 diff --git a/TP2/part_1/copy b/TP2/part_1/copy new file mode 100755 index 0000000..2de075f Binary files /dev/null and b/TP2/part_1/copy differ diff --git a/TP2/part_1/copy.c b/TP2/part_1/copy.c new file mode 100644 index 0000000..a3483a9 --- /dev/null +++ b/TP2/part_1/copy.c @@ -0,0 +1,35 @@ +#include +#include +#include + +int main(int argc, char *argv[]) { + if (argc != 3) { + printf("Usage: copy \n"); + exit(-1); + } + + FILE * ogf = fopen(argv[1], "r"); + if (ogf==NULL) { + perror("Error while opening file1"); + } + + FILE * tf = fopen(argv[2], "w+"); + if (tf==NULL) { + perror("Error while opening file2"); + } + + fseek(ogf, 0, SEEK_END); + int ogf_size = ftell(ogf); + fseek(ogf, 0, SEEK_SET); + + char * f = malloc(sizeof(char) * ogf_size); + fread(f, sizeof(char), ogf_size, ogf); + + fwrite(f, sizeof(char), ogf_size, tf); + + fclose(ogf); + fclose(tf); + + return 0; +} + diff --git a/TP2/part_1/dummy.log b/TP2/part_1/dummy.log new file mode 100644 index 0000000..dabadf2 --- /dev/null +++ b/TP2/part_1/dummy.log @@ -0,0 +1,2 @@ +UwU +Sussy Baka :3 diff --git a/TP2/part_1/dummy_append.log b/TP2/part_1/dummy_append.log new file mode 100644 index 0000000..f75988b --- /dev/null +++ b/TP2/part_1/dummy_append.log @@ -0,0 +1,16 @@ +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 +UwU +Sussy Baka :3 diff --git a/TP2/part_1/dummy_novowels.log b/TP2/part_1/dummy_novowels.log new file mode 100644 index 0000000..17a8412 --- /dev/null +++ b/TP2/part_1/dummy_novowels.log @@ -0,0 +1,2 @@ +UwU +I'm a Sussy Baka :3 diff --git a/TP2/part_1/dummy_novowels.log.bak b/TP2/part_1/dummy_novowels.log.bak new file mode 100644 index 0000000..decfe29 --- /dev/null +++ b/TP2/part_1/dummy_novowels.log.bak @@ -0,0 +1,2 @@ +UwU +I'm Sussy Baka :3 diff --git a/TP2/part_1/rm_vowels b/TP2/part_1/rm_vowels new file mode 100755 index 0000000..0d5ba5b Binary files /dev/null and b/TP2/part_1/rm_vowels differ diff --git a/TP2/part_1/rm_vowels.c b/TP2/part_1/rm_vowels.c new file mode 100644 index 0000000..1426751 --- /dev/null +++ b/TP2/part_1/rm_vowels.c @@ -0,0 +1,36 @@ +#include +#include +#include + +int main(int argc, char *argv[]) { + if (argc != 2) { + printf("Usage: rm_vowels \n"); + exit(-1); + } + + FILE * file = fopen(argv[1], "r+"); + if (file==NULL) { + perror("Error while opening file"); + } + + fseek(file, 0, SEEK_END); + int file_size = ftell(file); + fseek(file, 0, SEEK_SET); + + char * f = malloc(sizeof(char) * file_size); + fread(f, sizeof(char), file_size, file); + + fclose(file); + file = fopen(argv[1], "w+"); + + for(int i = 0; i +int main(int argc, char* argv[]) { + if(argc!=2) { + printf("Usage: tableau "); + return -1; + } + + int T[512]; + for (int i=0;i<512;i++) { + T[i] = i; + } + + FILE * F = fopen(argv[1], "w+"); + + fwrite(T, sizeof(int), 512, F); + + return 0; +} diff --git a/TP2/part_1/tableau_output b/TP2/part_1/tableau_output new file mode 100644 index 0000000..0980613 Binary files /dev/null and b/TP2/part_1/tableau_output differ diff --git a/TP2/part_3/out b/TP2/part_3/out new file mode 100644 index 0000000..ad9658d --- /dev/null +++ b/TP2/part_3/out @@ -0,0 +1 @@ +list: [9] 0, 9, 18, 27, 36, 45, 54, 63, 72 \ No newline at end of file diff --git a/TP2/part_3/serialization b/TP2/part_3/serialization new file mode 100755 index 0000000..932c8e2 Binary files /dev/null and b/TP2/part_3/serialization differ diff --git a/TP2/part_3/serialization.c b/TP2/part_3/serialization.c new file mode 100644 index 0000000..fa139d3 --- /dev/null +++ b/TP2/part_3/serialization.c @@ -0,0 +1,56 @@ +#include +#include + +#define INT_N 9 + +void write_list_to_stream(int * list, int size); +int * read_list_from_stream(); + +int main(int argc, char *argv[]) +{ + int * l = malloc(sizeof(int) * INT_N); + for (int i = 0; i +#include +#include +#include + +int * int_list_from_str(char * str); +int int_count_from_str(char * str); + +int main(int argc, char *argv[]) { + if (argc != 2) { + printf("Usage: %s \n", argv[0]); + return -1; + } + + printf("%d ints\n", int_count_from_str(argv[1])); + /*int * list = int_list_from_str(argv[1]); + for (int i=0; i 0) { + current_i *= -1; + } else { + return 0; + } + } + return list; +} + +int int_count_from_str(char * str) { + int ic = 0; + int current_i = 0; + int is_i = 1; + + int len = strlen(str); + for (int i = 0; i < len; i++) { + printf("str[%d]: %c\n", i, str[i]); + if (str[i] == ' ') { + if ((i+1 < len && str[i+1] != ' ') || (i+1)==len) ic++; + is_i = 0; + current_i = 0; + } else if (isdigit(str[i])) { + if (is_i) { + current_i *= 10; + } else { + is_i = 1; + } + current_i += (str[i] - '0'); + } else if (str[i]=='-' && current_i > 0) { + current_i *= -1; + } else { + return 0; + } + } + return ic; +} diff --git a/TP3/stringprinter b/TP3/stringprinter new file mode 100755 index 0000000..9bcd58a Binary files /dev/null and b/TP3/stringprinter differ diff --git a/TP3/stringprinter.c b/TP3/stringprinter.c new file mode 100644 index 0000000..f61e5e0 --- /dev/null +++ b/TP3/stringprinter.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc!=3) { + printf("Usage: %s ", argv[0]); + return -1; + } + + FILE * f = fopen(argv[1], "w+"); + if (f==NULL) { + printf("Error while opening file %s\n", argv[1]); + return -2; + } + + for (int i = 0; i<2000; i++) { + fprintf(f, "%s", argv[2]); + usleep(rand()%100); + } + + + fclose(f); + return 0; +} + +/* +* Si programme executé plusieurs fois sur le même fichier simultanément, deuxième programme lancé prend le pas après un court temps +*/ diff --git a/TP3/test b/TP3/test new file mode 100644 index 0000000..4f79322 --- /dev/null +++ b/TP3/test @@ -0,0 +1 @@ +UwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUwUUw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mmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmmhmmmmmm \ No newline at end of file diff --git a/TP4/ex_4 b/TP4/ex_4 new file mode 100755 index 0000000..5033095 Binary files /dev/null and b/TP4/ex_4 differ diff --git a/TP4/ex_4.c b/TP4/ex_4.c new file mode 100644 index 0000000..87f397d --- /dev/null +++ b/TP4/ex_4.c @@ -0,0 +1,74 @@ + +#include +int less(int a, int b); +int more(int a, int b); +int pair_more(int a, int b); + +void sort(int * tab, int size_tab, int (* sort_func)(int, int)); + +void print_tab(int * tab, int size) { + printf("tab[%d] = [", size); + for (int i=0; i b) { + return 1; + } else { + return -1; + } +} + +int pair_more(int a, int b) { + if (a%2==0) { + if (b%2!=0) { + return 1; + } else { + return more(a, b); + } + } + return -1; +} + +void sort(int * tab, int size_tab, int (* sort_func)(int, int)) { + int i,j, tmp; + for (i=0; i + +typedef union int_test { + int a; + char b[4]; +} test; + +void print_hex(int n); + +int main(int argc, char *argv[]) +{ + /*test i = {.a=429496729}; + for(int j=0; j<4; j++){ + printf("%d ", i.b[j]); + } + printf("\n");*/ + + print_hex(14*256 + 11*16 + 8); + print_hex(4*256 + 2*16 + 0); + return 0; +} + +void print_hex(int n) { + test i = {.a=n}; + for (int j=0; j<4; j++) { + printf("%d ", i.b[j]); + } + printf("\n"); +} diff --git a/TP4/union_ex3 b/TP4/union_ex3 new file mode 100755 index 0000000..6734952 Binary files /dev/null and b/TP4/union_ex3 differ diff --git a/TP4/union_ex3.c b/TP4/union_ex3.c new file mode 100644 index 0000000..dbf71e6 --- /dev/null +++ b/TP4/union_ex3.c @@ -0,0 +1,15 @@ +#include +#include + +void print_hex(int n); + +int main(int argc, char *argv[]) +{ + print_hex(14*256 + 11*16 + 8); //0xeb8 + print_hex(4*256 + 2*16 + 0); //0x420 + return 0; +} + +void print_hex(int n) { + printf("%x\n", n); +}