diff --git a/DEV1.1/TP08/alpha.c b/DEV1.1/TP08/alpha.c new file mode 100644 index 0000000..d2c1d2f --- /dev/null +++ b/DEV1.1/TP08/alpha.c @@ -0,0 +1,17 @@ +#include +#include + +int main(void) { + char min, maj; + char *p = NULL; + + for(min = 'a', maj = 'A'; maj <= 'Z'; min++, maj++) { + p = (p == &min) ? &maj : &min; + putchar(*p); + } + putchar('\n'); + return EXIT_SUCCESS; +} +9233654589353407584 + +100000000010010010000111111011010101000100010000101101000110000 \ No newline at end of file diff --git a/DEV1.1/TP08/carto.c b/DEV1.1/TP08/carto.c new file mode 100644 index 0000000..e95a90b --- /dev/null +++ b/DEV1.1/TP08/carto.c @@ -0,0 +1,22 @@ +#include +#include + +int main(int argc, char const *argv[]) +{ + float a = 1; + double b = 1; + long double c = 1; + char d = '1'; + short int e = 1; + int f = 1; + long long unsigned int g = 1; + + printf("%p \n",&a ); + printf("%p \n",&b ); + printf("%p \n",&c ); + printf("%p \n",&d ); + printf("%p \n",&e ); + printf("%p \n",&f ); + printf("%p \n",&g ); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP08/conversion.c b/DEV1.1/TP08/conversion.c new file mode 100644 index 0000000..61a95c6 --- /dev/null +++ b/DEV1.1/TP08/conversion.c @@ -0,0 +1,11 @@ +#include +#include + +int main(void) { + long long int n = 4614256656552045848LL; + double* p = (double*) &n; + printf("π = %f\n", *p); + long long int m = *p*2; + printf("%lld\n", m ); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV1.1/TP08/extension.c b/DEV1.1/TP08/extension.c new file mode 100644 index 0000000..3731f91 --- /dev/null +++ b/DEV1.1/TP08/extension.c @@ -0,0 +1,12 @@ +#include +#include +#include + +int main(void){ + + printf() + + + + +} \ No newline at end of file diff --git a/DEV1.1/TP08/initiales.c b/DEV1.1/TP08/initiales.c new file mode 100644 index 0000000..0b4bc71 --- /dev/null +++ b/DEV1.1/TP08/initiales.c @@ -0,0 +1,20 @@ +#include +#include +#include + +int main(int argc, char const *argv[]) +{ + if (argc<2){ + printf("argument manquant"); + return 1; + } + { + /* code */ + } + for (int i = 1; i < argc; i++) + { + printf("%c",argv[i][0]); + } + printf("\n"); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP08/lecture.c b/DEV1.1/TP08/lecture.c new file mode 100644 index 0000000..0cd350c --- /dev/null +++ b/DEV1.1/TP08/lecture.c @@ -0,0 +1,32 @@ +#include +#include +#include + +int main(void){ + char pass[10]= "password1"; + int i; + char out; + char string[26]; + printf("Rentrez le mot de passe(max 26 charactere): \n"); + for(i=0;i<26;i++){ + out = getchar(); + if(out=='\n'){ + break; + } + else{ + string[i]=out; + } + + } + for(i=0;i +#include +#include +int main(int argc, char const *argv[]) +{ + if (argc<=2) + { + printf("il manque des arguments. Il en faut 2, il y en a %d.\n",argc-1); + return 1; + } + for (int i = 0; i < strlen(argv[1]); ++i) + { + if(argv[1][i]=='.') + { + printf("Le premier argument n'est pas un reel.\n"); + return 1; + } + } + for (int i = 0; i < strlen(argv[2]); ++i) + { + if(argv[2][i]=='.') + { + printf("Le deuxieme argument n'est pas un reel.\n"); + return 1; + } + + } + long x = strtol(argv[1],NULL,10); + long y = strtol(argv[2],NULL,10); + printf("%ld \n", x*y); + return 0; +} \ No newline at end of file diff --git a/DEV1.1/TP08/stats.c b/DEV1.1/TP08/stats.c new file mode 100644 index 0000000..709089e --- /dev/null +++ b/DEV1.1/TP08/stats.c @@ -0,0 +1,37 @@ +#include +#include +#include + +int main(int argc, char const *argv[]) +{ + char txt[200]; + char dejavu[255]={' '}; + int dejavuuu=0; + printf("ecriver ici: \n"); + fgets(txt,200,stdin); + int nbE=0; + int nbC=0; + for (int i = 0; i < strlen(txt); ++i) + { + if(txt[i]=='e'||txt[i]=='E') + { + nbE++; + } + dejavuuu=0; + for (int j = 0; j < strlen(dejavu); ++j) + { + if (txt[i]==dejavu[j]) + { + dejavuuu++; + } + } + if (dejavuuu==0) + { + nbC++; + dejavu[nbC-1]=txt[i]; + } + } + printf("Il y a %d nombre de E ou e dans le texte entrée.\nIl y a %d nombre de charactere dans le texte.\n",nbE,nbC-1); + + return 0; +} \ No newline at end of file