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
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps
index e734c58..5e4f45a 100644
Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ
diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log
index 4c53ebc..da713cb 100644
--- a/cmake-build-debug/.ninja_log
+++ b/cmake-build-debug/.ninja_log
@@ -1,36 +1,24 @@
# ninja log v6
-14 22 1740403075154549031 Exercices 1155f81bcff01d1c
-0 14 1740403075140548939 CMakeFiles/Exercices.dir/main.c.o 30c179a7aefe8551
0 9 1740403312530213873 build.ninja 2e74603cecdb425f
-0 26 1740403317325247992 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-26 36 1740403317352248184 Exercices 1155f81bcff01d1c
-0 13 1740403435428088366 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-13 21 1740403435441088459 Exercices 1155f81bcff01d1c
-1 15 1740403873694161441 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-15 23 1740403873708161538 Exercices 1155f81bcff01d1c
-0 15 1740403932701569894 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-15 24 1740403932716569998 Exercices 1155f81bcff01d1c
-1 15 1740404429522008915 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-15 23 1740404429536009012 Exercices 1155f81bcff01d1c
-0 14 1740404434608044121 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-14 23 1740404434622044217 Exercices 1155f81bcff01d1c
-1 14 1740404445731121115 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-14 23 1740404445744121205 Exercices 1155f81bcff01d1c
-0 21 1740404452639168933 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-21 30 1740404452660169078 Exercices 1155f81bcff01d1c
-0 15 1740404929887310942 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-15 23 1740404929902311036 Exercices 1155f81bcff01d1c
-0 14 1740404945020405949 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-14 22 1740404945034406037 Exercices 1155f81bcff01d1c
-1 16 1740405250012320715 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-16 32 1740405250027320809 Exercices 1155f81bcff01d1c
-0 38 1740473535628230610 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-38 57 1740473535666230461 Exercices 1155f81bcff01d1c
-0 18 1740473558635746608 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-18 26 1740473558653749514 Exercices 1155f81bcff01d1c
-0 15 1740473607792717837 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-15 24 1740473607807717938 Exercices 1155f81bcff01d1c
-1 15 1740473619845938424 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-15 24 1740473619860938858 Exercices 1155f81bcff01d1c
-0 17 1740473682139410407 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
-17 25 1740473682155410510 Exercices 1155f81bcff01d1c
+1 18 1740477746111550441 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+18 26 1740477746128550542 Exercices 1155f81bcff01d1c
+1 18 1740477829595044425 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+18 26 1740477829612044526 Exercices 1155f81bcff01d1c
+0 17 1740477861646234077 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+17 26 1740477861663234177 Exercices 1155f81bcff01d1c
+1 17 1740477891058408113 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+17 26 1740477891074408208 Exercices 1155f81bcff01d1c
+1 20 1740477934685666262 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+20 31 1740477934704666374 Exercices 1155f81bcff01d1c
+1 18 1740478016833151774 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+18 26 1740478016850151874 Exercices 1155f81bcff01d1c
+0 17 1740478087417565974 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+17 27 1740478087433566068 Exercices 1155f81bcff01d1c
+0 23 1740478401554409376 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+23 38 1740478401577409511 Exercices 1155f81bcff01d1c
+1 18 1740478462453766742 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+18 26 1740478462470766842 Exercices 1155f81bcff01d1c
+0 17 1740478633838772455 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+17 26 1740478633855772554 Exercices 1155f81bcff01d1c
+1 17 1740478665576958699 CMakeFiles/Exercices.dir/main.c.o 51f95a9f148558b3
+17 27 1740478665593958799 Exercices 1155f81bcff01d1c
diff --git a/cmake-build-debug/CMakeFiles/Exercices.dir/main.c.o b/cmake-build-debug/CMakeFiles/Exercices.dir/main.c.o
index da12fa7..1d68cee 100644
Binary files a/cmake-build-debug/CMakeFiles/Exercices.dir/main.c.o and b/cmake-build-debug/CMakeFiles/Exercices.dir/main.c.o differ
diff --git a/cmake-build-debug/Exercices b/cmake-build-debug/Exercices
index fbae272..4c5346c 100755
Binary files a/cmake-build-debug/Exercices and b/cmake-build-debug/Exercices differ
diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log
index 624c831..9758b96 100644
--- a/cmake-build-debug/Testing/Temporary/LastTest.log
+++ b/cmake-build-debug/Testing/Temporary/LastTest.log
@@ -1,3 +1,3 @@
-Start testing: Feb 25 09:54 CET
+Start testing: Feb 25 11:17 CET
----------------------------------------------------------
-End testing: Feb 25 09:54 CET
+End testing: Feb 25 11:17 CET
diff --git a/main.c b/main.c
index 0124d8d..f9082bf 100644
--- a/main.c
+++ b/main.c
@@ -2,6 +2,7 @@
#include
#include
#include
+#include
// Variables
const int size=8;
@@ -11,13 +12,33 @@ int *alloc_tab(){
tab[0]=1;
tab[1]=2;
tab[2]=4;
- tab[3]=5;
- tab[4]=6;
+ tab[3]=8;
+ tab[4]=3;
tab[5]=7;
- tab[6]=9;
- tab[7]=10;
+ tab[6]=6;
+ tab[7]=9;
return tab;
}
+int generaterandoms(int min, int max, int count) {
+
+ // Taking current time as seed
+ unsigned int seed = time(0);
+
+ for (int i = 0; i < count; i++) {
+
+ // Generate a random number in the range [min, max]
+ int rd_num = rand_r(&seed) % (max - min + 1) + min;
+ return rd_num;
+ }
+}
+
+void display_tab(int tab[]) {
+ int i;
+ for (i=0; i1; i--) {
+ for (int j=0; jtab[j+1]) {
+ permutation(tab, j, j+1);
+ }
+ }
+ }
+ display_tab(tab);
+}
+
+void hiddennumber() {
+ int number= generaterandoms(0,64,1);
+ int selection;
+ int tries=1;
+ bool found=false;
+ printf("I choosed a number between 0 and 64, good luck ! \n");
+ while(found==false) {
+ printf("Make a guess ! \n");
+ scanf("%d",&selection);
+ if (selection==number) {
+ found=true;
+ printf("Hidden number found ! \n It was : %d \n", number);
+ printf("Found in %d tries \n", tries);
+ break;
+ }
+ else {
+ printf("WRONG ! \n");
+ tries++;
+ if (selection>number) {
+ printf("Smaller \n");
+ }
+ else if (selection