Added td6
This commit is contained in:
parent
93f98c6bd4
commit
fd91be9bdd
6 changed files with 121 additions and 0 deletions
32
td6/main.c
Executable file
32
td6/main.c
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
float a, b, c, res, delta1, delta2;
|
||||||
|
printf("a =");
|
||||||
|
scanf("%f", &a);
|
||||||
|
printf("b =");
|
||||||
|
scanf("%f", &b);
|
||||||
|
printf("c =");
|
||||||
|
scanf("%f", &c);
|
||||||
|
res = discriminant(a, b, c);
|
||||||
|
if (res < 0) {
|
||||||
|
printf("Elle ne possède pas de racine dans les réels");
|
||||||
|
}
|
||||||
|
else if (res == 0) {
|
||||||
|
delta1 = -b/(2*a);
|
||||||
|
printf("Elle possède une racine, étant %f", delta1);
|
||||||
|
}
|
||||||
|
else if (res > 0) {
|
||||||
|
delta1 = (-b - sqrt(res))/(2*a);
|
||||||
|
delta2 = (-b + sqrt(res))/(2*a);
|
||||||
|
printf("Elle possède deux racines, étant x1 = %f, x2 = %f", delta1, delta2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
float discriminant(float a, float b, float c){
|
||||||
|
float res;
|
||||||
|
res = b * b - 4*(a * c);
|
||||||
|
return res;
|
||||||
|
}
|
9
td6/main.h
Executable file
9
td6/main.h
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef MAIN_H_INCLUDED
|
||||||
|
#define MAIN_H_INCLUDED
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
float discriminant(float a, float b, float c);
|
||||||
|
|
||||||
|
#endif // MAIN_H_INCLUDED
|
42
td6/tdinfo.cbp
Executable file
42
td6/tdinfo.cbp
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<CodeBlocks_project_file>
|
||||||
|
<FileVersion major="1" minor="6" />
|
||||||
|
<Project>
|
||||||
|
<Option title="tdinfo" />
|
||||||
|
<Option pch_mode="2" />
|
||||||
|
<Option compiler="gcc" />
|
||||||
|
<Build>
|
||||||
|
<Target title="Debug">
|
||||||
|
<Option output="bin/Debug/tdinfo" 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/tdinfo" 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="main.c">
|
||||||
|
<Option compilerVar="CC" />
|
||||||
|
</Unit>
|
||||||
|
<Unit filename="main.h" />
|
||||||
|
<Extensions>
|
||||||
|
<lib_finder disable_auto="1" />
|
||||||
|
</Extensions>
|
||||||
|
</Project>
|
||||||
|
</CodeBlocks_project_file>
|
12
td6/tdinfo.depend
Executable file
12
td6/tdinfo.depend
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
# depslib dependency file v1.0
|
||||||
|
1600697112 source:d:\data\alzyohan\geii\info\tdinfo\main.c
|
||||||
|
"main.h"
|
||||||
|
|
||||||
|
1600017006 d:\data\alzyohan\geii\info\tdinfo\main.h
|
||||||
|
<stdio.h>
|
||||||
|
<stdlib.h>
|
||||||
|
<math.h>
|
||||||
|
|
||||||
|
1600697022 source:d:\data\alzyohan\geii\info\tdinfo\test.c
|
||||||
|
"main.h"
|
||||||
|
|
10
td6/tdinfo.layout
Executable file
10
td6/tdinfo.layout
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<CodeBlocks_layout_file>
|
||||||
|
<FileVersion major="1" minor="0" />
|
||||||
|
<ActiveTarget name="Debug" />
|
||||||
|
<File name="main.c" open="0" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
|
||||||
|
<Cursor>
|
||||||
|
<Cursor1 position="796" topLine="0" />
|
||||||
|
</Cursor>
|
||||||
|
</File>
|
||||||
|
</CodeBlocks_layout_file>
|
16
td6/test.c
Executable file
16
td6/test.c
Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
#include "main.h"
|
||||||
|
|
||||||
|
int bool()
|
||||||
|
{
|
||||||
|
int a;
|
||||||
|
scanf("%d", &a);
|
||||||
|
if (a >= 18)
|
||||||
|
{
|
||||||
|
printf("Vous etes majeur"); }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Vous etes mineur");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue