"depot M112"
This commit is contained in:
28
TD2/Exercice 1/.vscode/launch.json
vendored
Executable file
28
TD2/Exercice 1/.vscode/launch.json
vendored
Executable file
@ -0,0 +1,28 @@
|
||||
{
|
||||
// Utilisez IntelliSense pour en savoir plus sur les attributs possibles.
|
||||
// Pointez pour afficher la description des attributs existants.
|
||||
// Pour plus d'informations, visitez : https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "(gdb) Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "enter program name, for example ${workspaceFolder}/a.exe",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [],
|
||||
"externalConsole": true,
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "/path/to/gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
48
TD2/Exercice 1/Exercice 1.cbp
Executable file
48
TD2/Exercice 1/Exercice 1.cbp
Executable file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="Exercice 1" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/Exercice 1" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/Exercice 1" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
</Compiler>
|
||||
<Unit filename="fonctions.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="fonctions.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
29
TD2/Exercice 1/Exercice 1.depend
Executable file
29
TD2/Exercice 1/Exercice 1.depend
Executable file
@ -0,0 +1,29 @@
|
||||
# depslib dependency file v1.0
|
||||
1537950941 source:f:\cours\dut\m112\projets code block\td2\exercice 1\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537949992 f:\cours\dut\m112\projets code block\td2\exercice 1\fonctions.h
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
||||
1537950386 source:f:\cours\dut\m112\projets code block\td2\exercice 1\fonctions.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537950386 source:f:\cours\dut\m112\projets code block\td2\exercice 2\fonctions.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537949992 f:\cours\dut\m112\projets code block\td2\exercice 2\fonctions.h
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
||||
1537950273 source:f:\cours\dut\m112\projets code block\td2\exercice 2\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
20
TD2/Exercice 1/Exercice 1.layout
Executable file
20
TD2/Exercice 1/Exercice 1.layout
Executable file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Debug" />
|
||||
<File name="fonctions.h" open="0" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="61" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="fonctions.c" open="0" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="100" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="327" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
15
TD2/Exercice 1/fonctions.c
Executable file
15
TD2/Exercice 1/fonctions.c
Executable file
@ -0,0 +1,15 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fonctions.h"
|
||||
|
||||
int PPD(int nb)
|
||||
{
|
||||
int i = 2;
|
||||
int ver = nb;
|
||||
|
||||
while((ver % i) != 0)
|
||||
{
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
4
TD2/Exercice 1/fonctions.h
Executable file
4
TD2/Exercice 1/fonctions.h
Executable file
@ -0,0 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int PPD(int nb);
|
27
TD2/Exercice 1/main.c
Executable file
27
TD2/Exercice 1/main.c
Executable file
@ -0,0 +1,27 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fonctions.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int nb;
|
||||
int resu;
|
||||
|
||||
do{
|
||||
printf("Entrer un entier different de 0 ou 1\n");
|
||||
scanf("%d", &nb);
|
||||
if(nb == 0 || nb == 1)
|
||||
{
|
||||
printf("Erreur, veuillez entrer un entier different de 0 ou 1\n\n");
|
||||
}
|
||||
|
||||
}while(nb <=1);
|
||||
|
||||
resu = PPD(nb);
|
||||
|
||||
printf("Le plus petit diviseur de %d est %d\n\n", nb, resu);
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
48
TD2/Exercice 2/Exercice 2.cbp
Executable file
48
TD2/Exercice 2/Exercice 2.cbp
Executable file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="Exercice 1" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/Exercice 1" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/Exercice 1" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
</Compiler>
|
||||
<Unit filename="fonctions.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="fonctions.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
29
TD2/Exercice 2/Exercice 2.depend
Executable file
29
TD2/Exercice 2/Exercice 2.depend
Executable file
@ -0,0 +1,29 @@
|
||||
# depslib dependency file v1.0
|
||||
1537949699 source:f:\cours\dut\m112\projets code block\td2\exercice 1\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537948742 f:\cours\dut\m112\projets code block\td2\exercice 1\fonctions.h
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
||||
1537949627 source:f:\cours\dut\m112\projets code block\td2\exercice 1\fonctions.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537950559 source:f:\cours\dut\m112\projets code block\td2\exercice 2\fonctions.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537950565 f:\cours\dut\m112\projets code block\td2\exercice 2\fonctions.h
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
||||
1537950537 source:f:\cours\dut\m112\projets code block\td2\exercice 2\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
20
TD2/Exercice 2/Exercice 2.layout
Executable file
20
TD2/Exercice 2/Exercice 2.layout
Executable file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Debug" />
|
||||
<File name="fonctions.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="82" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="312" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="fonctions.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="58" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
22
TD2/Exercice 2/fonctions.c
Executable file
22
TD2/Exercice 2/fonctions.c
Executable file
@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fonctions.h"
|
||||
|
||||
int nbChiffres(int nb)
|
||||
{
|
||||
int count = 1;
|
||||
int ver;
|
||||
ver = nb;
|
||||
|
||||
while(ver != 0)
|
||||
{
|
||||
ver = ver / (10 * count);
|
||||
count++;
|
||||
}
|
||||
if (count !=0)
|
||||
{
|
||||
count--;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
4
TD2/Exercice 2/fonctions.h
Executable file
4
TD2/Exercice 2/fonctions.h
Executable file
@ -0,0 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int nbChiffres(int nb);
|
24
TD2/Exercice 2/main.c
Executable file
24
TD2/Exercice 2/main.c
Executable file
@ -0,0 +1,24 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fonctions.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
int nb;
|
||||
int resu;
|
||||
|
||||
printf("Entrer un entier\n");
|
||||
scanf("%d", &nb);
|
||||
|
||||
resu = nbChiffres(nb);
|
||||
|
||||
if(resu < 10 && resu >= 0)
|
||||
{
|
||||
printf("Il y a %d chiffre dans %d", resu, nb);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Il y a %d chiffres dans %d", resu, nb);
|
||||
}
|
||||
return 0;
|
||||
}
|
48
TD2/Exercice 3/Exercice 3.cbp
Executable file
48
TD2/Exercice 3/Exercice 3.cbp
Executable file
@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="Exercice 3" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="gcc" />
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="bin/Debug/Exercice 3" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-g" />
|
||||
</Compiler>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="bin/Release/Exercice 3" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="obj/Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="gcc" />
|
||||
<Compiler>
|
||||
<Add option="-O2" />
|
||||
</Compiler>
|
||||
<Linker>
|
||||
<Add option="-s" />
|
||||
</Linker>
|
||||
</Target>
|
||||
</Build>
|
||||
<Compiler>
|
||||
<Add option="-Wall" />
|
||||
</Compiler>
|
||||
<Unit filename="fonctions.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="fonctions.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
<lib_finder disable_auto="1" />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
14
TD2/Exercice 3/Exercice 3.depend
Executable file
14
TD2/Exercice 3/Exercice 3.depend
Executable file
@ -0,0 +1,14 @@
|
||||
# depslib dependency file v1.0
|
||||
1537952320 source:f:\cours\dut\m112\projets code block\td2\exercice 3\main.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
||||
1537952282 source:f:\cours\dut\m112\projets code block\td2\exercice 3\fonctions.c
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
"fonctions.h"
|
||||
|
||||
1537951573 f:\cours\dut\m112\projets code block\td2\exercice 3\fonctions.h
|
||||
<stdio.h>
|
||||
<stdlib.h>
|
||||
|
20
TD2/Exercice 3/Exercice 3.layout
Executable file
20
TD2/Exercice 3/Exercice 3.layout
Executable file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_layout_file>
|
||||
<FileVersion major="1" minor="0" />
|
||||
<ActiveTarget name="Debug" />
|
||||
<File name="fonctions.h" open="1" top="0" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="0" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="fonctions.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="221" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
<File name="main.c" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||
<Cursor>
|
||||
<Cursor1 position="218" topLine="0" />
|
||||
</Cursor>
|
||||
</File>
|
||||
</CodeBlocks_layout_file>
|
28
TD2/Exercice 3/fonctions.c
Executable file
28
TD2/Exercice 3/fonctions.c
Executable file
@ -0,0 +1,28 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "fonctions.h"
|
||||
|
||||
int fi(int nb)
|
||||
{
|
||||
int UNm1;
|
||||
int UNm2;
|
||||
int UN;
|
||||
int i = 3;
|
||||
|
||||
UNm2 = 1;
|
||||
UNm1 = 1;
|
||||
|
||||
if (nb <= 2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
while(i != nb)
|
||||
{
|
||||
UN = UNm1 + UNm2;
|
||||
UNm2 = UNm1;
|
||||
UNm1 = UN;
|
||||
i++;
|
||||
}
|
||||
return UN;
|
||||
}
|
4
TD2/Exercice 3/fonctions.h
Executable file
4
TD2/Exercice 3/fonctions.h
Executable file
@ -0,0 +1,4 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int fi(int nb);
|
16
TD2/Exercice 3/main.c
Executable file
16
TD2/Exercice 3/main.c
Executable file
@ -0,0 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int nb;
|
||||
int resu;
|
||||
|
||||
printf("Quelle valeur de la suite voulez vous afficher ?\n");
|
||||
scanf("%d", &nb);
|
||||
|
||||
resu = fi(nb);
|
||||
printf("La %deme valeur de la suite est %d!", nb, resu);
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user