Skip to content

Commit

Permalink
15
Browse files Browse the repository at this point in the history
  • Loading branch information
cfouche3005 committed Jan 17, 2022
1 parent b68e868 commit de3904a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ project(ISENAlgoC C)
set(CMAKE_C_STANDARD 11)

add_executable(ISENAlgoC
TP6/ex3/TP6ex3.c)
TP7/TP7.c)
40 changes: 40 additions & 0 deletions TP7/TP7.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#include<stdio.h>
#include<stdlib.h>
#include <string.h>
#include <stdbool.h>

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;
}

0 comments on commit de3904a

Please sign in to comment.