From de45003c5324509727841a3da1c1c7e4799d2750 Mon Sep 17 00:00:00 2001 From: Emmanuel Srivastava Date: Mon, 2 Dec 2024 13:59:14 +0100 Subject: [PATCH] update --- DEV.1.1/.gitignore | 75 +++++++++++++++++++++ DEV.1.1/Allocation_dynamique/1.Singletons.c | 24 +++++++ DEV.1.1/CM1/ex1.c | 10 +++ DEV.1.1/CM1/ex2.c | 15 +++++ DEV.1.1/CM1/ex3.c | 32 +++++++++ DEV.1.1/CM1/ex4.c | 13 ++++ DEV.1.1/CM1/ex4.html | 18 +++++ DEV.1.1/CM1/ex5.c | 26 +++++++ DEV.1.1/salut.c | 19 ++++++ 9 files changed, 232 insertions(+) create mode 100644 DEV.1.1/.gitignore create mode 100644 DEV.1.1/Allocation_dynamique/1.Singletons.c create mode 100644 DEV.1.1/CM1/ex1.c create mode 100644 DEV.1.1/CM1/ex2.c create mode 100644 DEV.1.1/CM1/ex3.c create mode 100644 DEV.1.1/CM1/ex4.c create mode 100644 DEV.1.1/CM1/ex4.html create mode 100644 DEV.1.1/CM1/ex5.c create mode 100644 DEV.1.1/salut.c diff --git a/DEV.1.1/.gitignore b/DEV.1.1/.gitignore new file mode 100644 index 0000000..3417814 --- /dev/null +++ b/DEV.1.1/.gitignore @@ -0,0 +1,75 @@ +# ---> C +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +# ---> Vim +# Swap +[._]*.s[a-v][a-z] +!*.svg # comment out if you don't need vector files +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + diff --git a/DEV.1.1/Allocation_dynamique/1.Singletons.c b/DEV.1.1/Allocation_dynamique/1.Singletons.c new file mode 100644 index 0000000..5abe52e --- /dev/null +++ b/DEV.1.1/Allocation_dynamique/1.Singletons.c @@ -0,0 +1,24 @@ +#include +#include + +int main(void){ + int i,nb_elem; + int* list = NULL; + + printf("Inserez la taille : "); + scanf("%d",&nb_elem); + + list = (int*) malloc(nb_elem*sizeof(int)); + + for(i=0;i!=nb_elem;i++){ + printf("inserez un entier à l'indice numéro %d : ", i); + scanf("%d",&list[i]); + } + for(i=0; i!= nb_elem; i++){ + if (list[i]==list[i+1]){ + printf("%d ", list[i]); + }else{ + printf(""); + } + } +} \ No newline at end of file diff --git a/DEV.1.1/CM1/ex1.c b/DEV.1.1/CM1/ex1.c new file mode 100644 index 0000000..1b559ed --- /dev/null +++ b/DEV.1.1/CM1/ex1.c @@ -0,0 +1,10 @@ +#include +#include + +int main(void){ + printf(" __\n"); + printf("(___()'`;\n"); + printf("/, /`\n"); + printf("\\\\\"--\\\\\n"); + +} diff --git a/DEV.1.1/CM1/ex2.c b/DEV.1.1/CM1/ex2.c new file mode 100644 index 0000000..34636d3 --- /dev/null +++ b/DEV.1.1/CM1/ex2.c @@ -0,0 +1,15 @@ +#include +#include + +int main(void) { + short int a = 7; + unsigned char b = 77; + float c = 777; + long int d = 7777; + + printf("%03hd\n", a); + printf("%c\n", b); + printf("%.0f\n", c); + printf("%lx\n", d); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/DEV.1.1/CM1/ex3.c b/DEV.1.1/CM1/ex3.c new file mode 100644 index 0000000..3362503 --- /dev/null +++ b/DEV.1.1/CM1/ex3.c @@ -0,0 +1,32 @@ +#include +#include + +int main(void){ + int premdes, dodes; + + printf("Entrez le premier dé : "); + scanf("%d", &premdes); + printf("Entrez le second dé : "); + scanf("%d", &dodes); + + if(premdes!=1){ + if(premdes!=6){ + if(premdes==dodes){ + printf("Hard ways\n"); + } + }else if(premdes==6){ + if(dodes==6){ + printf("Boxcars"); + } + } + }else if(premdes==1){ + if(dodes==1){ + printf("snake eyes\n"); + }} + } + + + + + + \ No newline at end of file diff --git a/DEV.1.1/CM1/ex4.c b/DEV.1.1/CM1/ex4.c new file mode 100644 index 0000000..781f17f --- /dev/null +++ b/DEV.1.1/CM1/ex4.c @@ -0,0 +1,13 @@ +#include +#include + +int main(void){ + int i,j; + + for(i=1;i<=20;i++){ + for(j=1;j<=i;j++){ + printf(" %d ",(i+j)/2); + } + } + +} \ No newline at end of file diff --git a/DEV.1.1/CM1/ex4.html b/DEV.1.1/CM1/ex4.html new file mode 100644 index 0000000..1df417e --- /dev/null +++ b/DEV.1.1/CM1/ex4.html @@ -0,0 +1,18 @@ +#include +#include + +int main(void){ + int i,j; + + for(i=1;i<=20;i++){ + for(j=1;j<=i;j++){ + printf(" %d ",(i+j)/2); + } + } + +}htmlhrtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlhtmlh cssc cssc cscccs cs cscsc struct + + +{ + +}; \ No newline at end of file diff --git a/DEV.1.1/CM1/ex5.c b/DEV.1.1/CM1/ex5.c new file mode 100644 index 0000000..15c4bd4 --- /dev/null +++ b/DEV.1.1/CM1/ex5.c @@ -0,0 +1,26 @@ +#include +#include +#define PORTA 5 +#define CROIS 4 +#define aCONTORP 3 +#define bCONTORP 3 +#define TORP 2 + +int main(void){ + int coord[10][10],x,y,i; + + for(i=0;PORTA<0;PORTA){ + coord[1][i] = 1; + + } + + + + while(coord[10][10]!= {0}){ + printf("Coordonées? "); + scanf("%d %d",&x,&y); + if(coord[]==x){ + if(y==) + } + } +} \ No newline at end of file diff --git a/DEV.1.1/salut.c b/DEV.1.1/salut.c new file mode 100644 index 0000000..303bb07 --- /dev/null +++ b/DEV.1.1/salut.c @@ -0,0 +1,19 @@ +#include +#include + +int main(void) { + int* p = NULL; + p = (int*) malloc(2*sizeof(int)); + if (p) { + printf("Entrez un entier : "); + scanf("%d", p); + printf("Entrez un second entier : "); + scanf("%d", p + 1); + printf("Leur somme vaut %d.\n", p[0] + p[1]); + free(p); + return EXIT_SUCCESS; + } else { + puts("Espace mémoire insuffisant !"); + return EXIT_FAILURE; + } +} \ No newline at end of file