60 lines
1.0 KiB
C
60 lines
1.0 KiB
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
char *my_weirddup(char *src){
|
|
|
|
if(src == NULL) return NULL;
|
|
|
|
int index = 0;
|
|
while(*(src + index)){
|
|
index ++;
|
|
}
|
|
|
|
char *str = malloc(index);
|
|
if(str == NULL) return NULL;
|
|
|
|
//printf("test");
|
|
|
|
char lettre = ' ';
|
|
index = 0;
|
|
|
|
while (*(src + index) != '\0'){
|
|
|
|
lettre = *(src + index);
|
|
|
|
//MAJ
|
|
if (lettre > 64 && lettre < 91){
|
|
if (lettre == 'Z') lettre = 'A';
|
|
else lettre ++;
|
|
}
|
|
|
|
//min
|
|
if (lettre > 96 && lettre < 124) {
|
|
if (lettre == 'z') lettre = 'a';
|
|
else lettre ++;
|
|
}
|
|
|
|
*(str + index) = lettre;
|
|
index ++;
|
|
}
|
|
|
|
*(str + index + 1) = '\0';
|
|
return str;
|
|
|
|
}
|
|
//TODO MARCHE MAIS À COMPLETER
|
|
|
|
int main(int args ,char **arg){
|
|
|
|
int index = 1;
|
|
char *rslt = "";
|
|
|
|
while(index < args){
|
|
rslt = my_weirddup(*(arg + index));
|
|
printf("%s\n",rslt);
|
|
free(rslt);
|
|
index ++;
|
|
}
|
|
|
|
}
|