X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TP_13%2Fexo1%2Flib%2Fio.c;h=884d4a0b730f1d6e266628f326866a4e829112a2;hb=59941dc1cf415077fbfbde8b313e52e8f3fc6fe5;hp=989e746aa237cd90d18c0b3861427deefd5f1bf2;hpb=475ee86d70921638c700bc0934441c7fe2c905d1;p=TD_C.git diff --git a/TP_13/exo1/lib/io.c b/TP_13/exo1/lib/io.c index 989e746..884d4a0 100644 --- a/TP_13/exo1/lib/io.c +++ b/TP_13/exo1/lib/io.c @@ -28,7 +28,10 @@ void display_choice_menu() { printf("2) Trier le tableau.\n"); printf("3) Afficher le tableau.\n"); printf("4) Compter le nombre d'occurence d'un entier dans le tableau.\n"); - printf("5) Quitter.\n"); + printf("5) Compter le nombre d'entiers pairs dans le tableau.\n"); + printf("6) Compter le nombre d'entiers impairs dans le tableau.\n"); + printf("7) Redimensionner le tableau.\n"); + printf("8) Quitter.\n"); } int* do_concat(int array[], unsigned* size) { @@ -77,6 +80,7 @@ void do_sort(int array[], unsigned size) { criteria = ascending_and_odd; break; default: + /* sort ascending by default, unused code path */ criteria = ascending; break; } @@ -92,6 +96,16 @@ void do_count(int array[], unsigned size) { printf("La valeur %d est presente %d fois dans le tableau\n", search_value, count_tab_element(array, size, search_value)); } +void do_resize(int array[], unsigned* old_size) { + int errno = 0; + unsigned new_size = 0; + + errno = prompt_value("\nNouvelle taille?", (int*)&new_size); + handle_prompt_error(errno); + array = resize_tab(array, *old_size, new_size); + *old_size = new_size; +} + void display_array(int array[], unsigned size) { if (array != NULL) { printf("\n--array begin--\n");