commit 74ae59830117a440c9c175623db0e93e23da4429 Author: bouchane Date: Tue Jan 7 21:10:07 2025 +0100 Resolution_Exercices diff --git a/Resolution_Exercices/#struct# b/Resolution_Exercices/#struct# new file mode 100644 index 0000000..5d1d32a --- /dev/null +++ b/Resolution_Exercices/#struct# @@ -0,0 +1,37 @@ +#include +#include +struct person { + int age; + float weight; + char name[30]; +}; + +int main() +{ + struct person *ptr; + int i, n; + + printf("Enter the number of persons: "); + scanf("%d", &n); + + // allocating memory for n numbers of struct person + ptr = (struct person*) malloc(n * sizeof(struct person)); + + for(i = 0; i < n; ++i) + { + printf("Enter first name and age respectively: "); + + // To access members of 1st struct person, + // ptr->name and ptr->age is used + + // To access members of 2nd struct person, + // (ptr+1)->name and (ptr+1)->age is used + scanf("%s %d", (ptr+i)->name, &(ptr+i)->age); + } + + printf("Displaying Information:\n"); + for(i = 0; i < n; ++i) + printf("Name: %s\tAge: %d\n", (ptr+i)->name, (ptr+i)->age); + + return 0; +} diff --git a/Resolution_Exercices/Fichier.c b/Resolution_Exercices/Fichier.c new file mode 100644 index 0000000..e9fbf4c --- /dev/null +++ b/Resolution_Exercices/Fichier.c @@ -0,0 +1,31 @@ +#include +#include + +int main(void){ + FILE* flux; + size_t lu; + int score,nom; + char a; + char b; + char c; + int i; + flux = fopen("top10", "r"); + if (flux==NULL){ + printf("erreur d'ouverture \n"); + return EXIT_FAILURE; + } + for (i=0;i<10;i++){ + lu = fread(&score, sizeof(int),1,flux); + printf("09%d", score,nom); + lu = fread(&a,sizeof(char),1,flux); + lu = fread(&b,sizeof(char),1,flux); + lu = fread(&c,sizeof(char),1,flux); + printf(" %c",a); + printf("%c",b); + printf("%c \n",c); + }fclose(flux); + return EXIT_SUCCESS; +} + + + diff --git a/Resolution_Exercices/Fonction.c b/Resolution_Exercices/Fonction.c new file mode 100644 index 0000000..5923253 --- /dev/null +++ b/Resolution_Exercices/Fonction.c @@ -0,0 +1,26 @@ +#include +#include + +int init_ball (int posX) /*Ici on créer une fonction pour initialiser la balle sur sa position X*/ +{ + posX = 150; + + return 0; + +} +/* EXEMPLE POUR UN JEU DE BALLE DONC RIEN NE SERA AFFICHER DANS LE TERMINAL C NORMAL */ +int main(void) +{ + /*Exemple de fonctions: + printf() + scanf() + */ + + int balleX; /* balleX et posX ne sont pas les mêmes*/ + balleX = init_ball(balleX); + /*Une partie de jeu se fait...*/ + + balleX = init_ball(balleX); + + return 0; +} diff --git a/Resolution_Exercices/Makefile b/Resolution_Exercices/Makefile new file mode 100644 index 0000000..a5c8ea5 --- /dev/null +++ b/Resolution_Exercices/Makefile @@ -0,0 +1,38 @@ +# nom de l'exécutable final +EXEC = programme + +# liste des fichiers source à utiliser +SRC = main.c jeux.c ecran.c bot.c + +# génère les fichiers objets de chaque fichier source +OBJ = $(SRC:.c=.o) + +# options de compilation (ajoute -Wall pour les avertissements) +CFLAGS = -Wall -ansi -pedantic + +# commande pour compiler +CC = gcc + +# permet l'éxécution avec la commande make +all: $(EXEC) + +# génération de l'exécutable +$(EXEC): $(OBJ) + $(CC) -o $(EXEC) $(OBJ) $(CFLAGS) -lgraph + +# compilation de chaque fichier source en un fichier objet +%.o: %.c %.h + $(CC) -o $@ -c $< $(CFLAGS) + +# commande pour lancer l'exécutable +run: $(EXEC) + ./$(EXEC) + +# nettoyage des fichiers et réinitialisation du projet afin de le relancer proprement +clean: + rm -f $(OBJ) $(EXEC) + + +mrproper: clean + rm -f $(EXEC) + diff --git a/Resolution_Exercices/Pointeurs.c b/Resolution_Exercices/Pointeurs.c new file mode 100644 index 0000000..7acbed7 --- /dev/null +++ b/Resolution_Exercices/Pointeurs.c @@ -0,0 +1,50 @@ +#include +#include + +/*Pointeur : varible contenat l'adresse d'une autre variable + %d -> affiche une adresse de variable ou pointeur + + [VARIABLES] + maVariable : valeur de la variable + &maVariable : adresse de ma variable + + [POINTEURS] + *monPointeur = NULL ou *monPointeur = &maVariable + (déclaration et initialisation d'un pointeur) + + monPointeur : adresse de la varible pointée + *monPointeur : valeur de la variable pointée + &monPointeur : adresse du pointeur +*/ + +void inverser_nombres(int *pt_nb1,int *pt_nb2) /* C'est une fonction */ +{ + int temporaire = 0; /*B*/ + temporaire = *pt_nb2; /* *pt_nb2 prend la valeur de la variable temporaire*/ + *pt_nb2 = *pt_nb1;/* *pt_nb1 prend la valeur de *pt_nb2 */ + *pt_nb1 = temporaire; /* *pt_nb1 prend la valeur de temporaire */ +} +int main (void) +{ + int nombreA = 15; + int nombreB = 28; + + int *pointeursurNombreA = &nombreA; + int *pointeursurNombreB = &nombreB; + + printf ("Avant : A = %d et B = %d \n", nombreA, nombreB); + inverser_nombres(pointeursurNombreA, pointeursurNombreB); + printf ("Après : A =%d et B = %d \n", nombreA, nombreB); + + return 0; +} + +/*Resultat : + Avant : A = 15 et B = 28 +Après : A =28 et B = 15 +*/ + + + + + diff --git a/Resolution_Exercices/Recursivite.c b/Resolution_Exercices/Recursivite.c new file mode 100644 index 0000000..3bfb885 --- /dev/null +++ b/Resolution_Exercices/Recursivite.c @@ -0,0 +1,22 @@ +#include +int sum(int n); + +int main() { + int number, result; + + printf("Enter a positive integer: "); + scanf("%d", &number); + + result = sum(number); + + printf("sum = %d", result); + return 0; +} + +int sum(int n) { + if (n != 0) + /*sum() function calls itself*/ + return n + sum(n-1); + else + return n; +} diff --git a/Resolution_Exercices/Strings.c b/Resolution_Exercices/Strings.c new file mode 100644 index 0000000..de4ab04 --- /dev/null +++ b/Resolution_Exercices/Strings.c @@ -0,0 +1,9 @@ +#include +int main() +{ + char name[20]; + printf("Enter name: "); + scanf("%s", name); + printf("Your name is %s.", name); + return 0; +} diff --git a/Resolution_Exercices/Strings3.c b/Resolution_Exercices/Strings3.c new file mode 100644 index 0000000..7168270 --- /dev/null +++ b/Resolution_Exercices/Strings3.c @@ -0,0 +1,16 @@ +#include +void displayString(char str[]); + +int main() +{ + char str[50]; + printf("Enter string: "); + fgets(str, sizeof(str), stdin); + displayString(str); /* Passing string to a function. */ + return 0; +} +void displayString(char str[]) +{ + printf("String Output: "); + puts(str); +} diff --git a/Resolution_Exercices/a.out b/Resolution_Exercices/a.out new file mode 100755 index 0000000..d053412 Binary files /dev/null and b/Resolution_Exercices/a.out differ diff --git a/Resolution_Exercices/calloc_and_free.c b/Resolution_Exercices/calloc_and_free.c new file mode 100644 index 0000000..470af48 --- /dev/null +++ b/Resolution_Exercices/calloc_and_free.c @@ -0,0 +1,24 @@ +#include +#include + +int main() { + int n, i, *ptr, sum = 0; + printf("Enter number of elements: "); + scanf("%d", &n); + + ptr = (int*) calloc(n, sizeof(int)); + if(ptr == NULL) { + printf("Error! memory not allocated."); + exit(0); + } + + printf("Enter elements: "); + for(i = 0; i < n; ++i) { + scanf("%d", ptr + i); + sum += *(ptr + i); + } + + printf("Sum = %d", sum); + free(ptr); + return 0; +} diff --git a/Resolution_Exercices/fgets.c b/Resolution_Exercices/fgets.c new file mode 100644 index 0000000..b6f393e --- /dev/null +++ b/Resolution_Exercices/fgets.c @@ -0,0 +1,10 @@ +#include +int main() +{ + char name[30]; + printf("Enter name: "); + fgets(name, sizeof(name), stdin); /* read string*/ + printf("Name: "); + puts(name); /* display string*/ + return 0; +} diff --git a/Resolution_Exercices/lespourcentssignifications.c b/Resolution_Exercices/lespourcentssignifications.c new file mode 100644 index 0000000..da05049 --- /dev/null +++ b/Resolution_Exercices/lespourcentssignifications.c @@ -0,0 +1,15 @@ + +#include + +int main() { + int age = 30; + float taille = 1.75; + char initiale = 'A'; + + /* Utilisation de plusieurs spécificateurs de format*/ + printf("Âge : %d\n", age); + printf("Taille : %.2f m\n", taille);/* Le 2 ici correspond au nb de chiffres derrière la virgules*/ + printf("Initiale : %c\n", initiale); + + return 0; +} diff --git a/Resolution_Exercices/malloc_and_free.c b/Resolution_Exercices/malloc_and_free.c new file mode 100644 index 0000000..36e716b --- /dev/null +++ b/Resolution_Exercices/malloc_and_free.c @@ -0,0 +1,31 @@ +#include +#include + +int main() { + int n, i, *ptr, sum = 0; + + printf("Enter number of elements: "); + scanf("%d", &n); + + ptr = (int*) malloc(n * sizeof(int)); + + + if(ptr == NULL) { + printf("Error! memory not allocated."); + exit(0); + } + + printf("Enter elements: "); + for(i = 0; i < n; ++i) { + scanf("%d", ptr + i); + sum += *(ptr + i); + } + + printf("Sum = %d", sum); + + + free(ptr); + + return 0; +} + diff --git a/Resolution_Exercices/realloc.c b/Resolution_Exercices/realloc.c new file mode 100644 index 0000000..3d38217 --- /dev/null +++ b/Resolution_Exercices/realloc.c @@ -0,0 +1,28 @@ +#include +#include + +int main() { + int *ptr, i , n1, n2; + printf("Enter size: "); + scanf("%d", &n1); + + ptr = (int*) malloc(n1 * sizeof(int)); + + printf("Addresses of previously allocated memory:\n"); + for(i = 0; i < n1; ++i) + printf("%pc\n",ptr + i); + + printf("\nEnter the new size: "); + scanf("%d", &n2); + + /* rellocating the memory*/ + ptr = realloc(ptr, n2 * sizeof(int)); + + printf("Addresses of newly allocated memory:\n"); + for(i = 0; i < n2; ++i) + printf("%pc\n", ptr + i); + + free(ptr); + + return 0; +} diff --git a/Resolution_Exercices/strcat.c b/Resolution_Exercices/strcat.c new file mode 100644 index 0000000..f9a4b7d --- /dev/null +++ b/Resolution_Exercices/strcat.c @@ -0,0 +1,16 @@ +#include +#include +int main() { + char str1[100] = "This is ", str2[] = "programiz.com ", str3[]="Yes Yes !"; + + /* concatenates str1 and str2*/ + /* the resultant string is stored in str1.*/ + strcat(str1, str2); + strcat(str1, str3); + + puts(str1); + puts(str2); + puts(str3); + + return 0; +} diff --git a/Resolution_Exercices/strcmp.c b/Resolution_Exercices/strcmp.c new file mode 100644 index 0000000..0471bee --- /dev/null +++ b/Resolution_Exercices/strcmp.c @@ -0,0 +1,20 @@ +#include +#include + +int main() { + char str1[] = "abcd", str2[] = "abCd", str3[] = "abcd"; + int result; + + /* comparing strings str1 and str2*/ + result = strcmp(str1, str2); + printf("strcmp(str1, str2) = %d\n", result); + + /* comparing strings str1 and str3*/ + result = strcmp(str1, str3); + printf("strcmp(str1, str3) = %d\n", result); + + result = strcmp(str2,str3); + printf("strcmp(str2,str3)=%d\n", result); + + return 0; +} diff --git a/Resolution_Exercices/strcpy.c b/Resolution_Exercices/strcpy.c new file mode 100644 index 0000000..33629b2 --- /dev/null +++ b/Resolution_Exercices/strcpy.c @@ -0,0 +1,18 @@ +#include +#include + +int main() { + char str1[20] = "C programming"; + char str2[20]; + char str3[30] = "Good Good"; + char str4[30]; + + /* copying str1 to str2*/ + /* copying str3 to str4*/ + strcpy(str2, str1); + strcpy(str4, str3); + + puts(str2); /* C programming*/ + puts(str4);/*Good Good*/ + return 0; +} diff --git a/Resolution_Exercices/strlen.c b/Resolution_Exercices/strlen.c new file mode 100644 index 0000000..f92556c --- /dev/null +++ b/Resolution_Exercices/strlen.c @@ -0,0 +1,13 @@ +#include +#include +int main() +{ + char a[20]="Program"; + char b[20]={'P','r','o','g','r','a','m','\0'}; + + /* using the %zu format specifier to print size_t*/ + printf("Length of string a = %zu \n",strlen(a)); + printf("Length of string b = %zu \n",strlen(b)); + + return 0; +} diff --git a/Resolution_Exercices/struc.c b/Resolution_Exercices/struc.c new file mode 100644 index 0000000..a7c3187 --- /dev/null +++ b/Resolution_Exercices/struc.c @@ -0,0 +1,23 @@ +#include +#include + +/*STRUCT*/ + +struct student { + char *name; + int age; + float grade; +}; +int main(void){ + struct student engStudent; + engStudent.name ="Jon Snow"; + engStudent.age = 19; + engStudent.grade =8.5; + + printf("Name: %s\n, engStudent.name"); + printf("Age: %d\n, engStudent.age"); + printf("Grade: %f\n, engStudent.grade"); + + return 0; +} + diff --git a/Resolution_Exercices/struct_function.c b/Resolution_Exercices/struct_function.c new file mode 100644 index 0000000..bf0d85d --- /dev/null +++ b/Resolution_Exercices/struct_function.c @@ -0,0 +1,35 @@ +#include +struct student +{ + char name[50]; + int age; +}; + +/* function prototype*/ +struct student getInformation(); + +int main() +{ + struct student s; + + s = getInformation(); + + printf("\nDisplaying information\n"); + printf("Name: %s", s.name); + printf("\nRoll: %d", s.age); + + return 0; +} +struct student getInformation() +{ + struct student s1; + + printf("Enter name: "); + scanf ("%[^\n]%*c", s1.name); + + printf("Enter age: "); + scanf("%d", &s1.age); + + return s1; +} + diff --git a/Resolution_Exercices/structure.c b/Resolution_Exercices/structure.c new file mode 100644 index 0000000..1f2baf4 --- /dev/null +++ b/Resolution_Exercices/structure.c @@ -0,0 +1,24 @@ +#include +struct person +{ + int age; + float weight; +}; + +int main() +{ + struct person *personPtr, person1; + personPtr = &person1; + + printf("Enter age: "); + scanf("%d", &personPtr->age); + + printf("Enter weight: "); + scanf("%f", &personPtr->weight); + + printf("Displaying:\n"); + printf("Age: %d\n", personPtr->age); + printf("weight: %f", personPtr->weight); + + return 0; +} diff --git a/Resolution_Exercices/structure_allocation.c b/Resolution_Exercices/structure_allocation.c new file mode 100644 index 0000000..4bfc2a6 --- /dev/null +++ b/Resolution_Exercices/structure_allocation.c @@ -0,0 +1,37 @@ +#include +#include +struct person { + int age; + float weight; + char name[30]; +}; + +int main() +{ + struct person *ptr; + int i, n; + + printf("Enter the number of persons: "); + scanf("%d", &n); + + /*allocating memory for n numbers of struct person*/ + ptr = (struct person*) malloc(n * sizeof(struct person)); + + for(i = 0; i < n; ++i) + { + printf("Enter first name and age respectively: "); + + /* To access members of 1st struct person,*/ + /* ptr->name and ptr->age is used*/ + + /* To access members of 2nd struct person,*/ + /* (ptr+1)->name and (ptr+1)->age is used*/ + scanf("%s %d", (ptr+i)->name, &(ptr+i)->age); + } + + printf("Displaying Information:\n"); + for(i = 0; i < n; ++i) + printf("Name: %s\tAge: %d\n", (ptr+i)->name, (ptr+i)->age); + + return 0; +} diff --git a/site2.html b/site2.html new file mode 100644 index 0000000..f790670 --- /dev/null +++ b/site2.html @@ -0,0 +1,261 @@ + + + + + + Green Cocooning - Kawaii + + + + + + +
+

Green Cocooning

+

Un havre de paix naturel et mignon pour l'âme et le corps

+
+ + + + + +
+

Bienvenue dans l'univers du Green Cocooning

+

+ Le cocooning est un art de vivre qui consiste à créer un espace de confort et de bien-être. + Ici, nous avons choisi de célébrer la nature, en intégrant des éléments verts, des matériaux naturels, + et des ambiances apaisantes, le tout dans un cadre mignon et lumineux. +

+ Cocooning naturel +
+ + +
+

Nos Conseils pour un Cocooning Mignon et Naturel

+
+
+ Plantes d'intérieur +

Ajoutez des plantes d'intérieur

+

Les plantes apportent de la verdure et purifient l'air, créant ainsi un environnement apaisant et mignon.

+
+
+ Couverture confortable +

Investissez dans des textiles naturels

+

Des couvertures en laine, des coussins en coton bio et des tapis en jute ajoutent du confort à votre espace.

+
+
+ Ambiance apaisante +

Créez une ambiance douce et apaisante

+

Optez pour des éclairages doux et des bougies naturelles pour une atmosphère relaxante et kawaii.

+
+
+
+ + +
+

Nos Produits Écologiques

+
+
+

Plantes en Pot

+

Découvrez notre collection de plantes d'intérieur pour un cadre plus vert et sain.

+ Voir les produits +
+
+

Textiles Naturels

+

Des coussins, couvertures et rideaux en matériaux organiques et durables.

+ Voir les produits +
+
+

Décoration Écologique

+

Des objets décoratifs en bois recyclé, en bambou et en matériaux naturels.

+ Voir les produits +
+
+
+ + + + + + +