"depot M112"

This commit is contained in:
JunkJumper
2020-05-03 14:14:20 +02:00
parent e487fc8c7c
commit d0c6ee52c6
37 changed files with 1016 additions and 0 deletions

48
TD2/Exercice 2/Exercice 2.cbp Executable file
View 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>

View 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"

View 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
View 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
View File

@ -0,0 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
int nbChiffres(int nb);

24
TD2/Exercice 2/main.c Executable file
View 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;
}