From de3904a987bad300c6ddd99aabecf5599c9a938d Mon Sep 17 00:00:00 2001 From: cfouche Date: Mon, 17 Jan 2022 14:45:09 +0100 Subject: [PATCH] 15 --- CMakeLists.txt | 2 +- TP7/TP7.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 TP7/TP7.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eab6ba..eb596b5 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,4 +4,4 @@ project(ISENAlgoC C) set(CMAKE_C_STANDARD 11) add_executable(ISENAlgoC - TP6/ex3/TP6ex3.c) + TP7/TP7.c) diff --git a/TP7/TP7.c b/TP7/TP7.c new file mode 100644 index 0000000..4bca5f4 --- /dev/null +++ b/TP7/TP7.c @@ -0,0 +1,40 @@ +#include +#include +#include +#include + +int main (int argc, char** argv) { + int taille=strlen(argv[1]); + printf("%s\n",argv[1]); + + char* copy1; + copy1= malloc ((taille+1)*sizeof (char) ) ; + if (copy1 != NULL){ + strcpy (copy1, argv[1]); + int i = 0; + while (copy1[i] != '\0') + { + if (copy1[i] >= 97 && copy1[i] <= 122) + copy1[i] = copy1[i] - 32; + i++; + } + printf("%s\n",copy1); + free(copy1); + } + char* copy2; + copy2= malloc ((taille+1)*sizeof (char) ) ; + if (copy2 != NULL){ + strcpy (copy2, argv[1]); + int j = 0; + while (copy2[j] != '\0') + { + if (copy2[j] >= 65 && copy2[j] <= 90) + copy2[j] = copy2[j] + 32; + j++; + } + printf("%s\n",copy2); + free(copy2); + } + + return 0; +} \ No newline at end of file