diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | res/exp.tpc | 5 | ||||
-rw-r--r-- | res/instr.tpc | 28 | ||||
-rw-r--r-- | res/trinome.tpc | 43 |
4 files changed, 77 insertions, 0 deletions
@@ -12,6 +12,7 @@ | |||
12 | !*.txt | 12 | !*.txt |
13 | !*.md | 13 | !*.md |
14 | !*.tex | 14 | !*.tex |
15 | !*.tpc | ||
15 | 16 | ||
16 | *.yy.c | 17 | *.yy.c |
17 | *.tab.c | 18 | *.tab.c |
diff --git a/res/exp.tpc b/res/exp.tpc new file mode 100644 index 0000000..471c068 --- /dev/null +++ b/res/exp.tpc | |||
@@ -0,0 +1,5 @@ | |||
1 | /* exp.tpc */ | ||
2 | |||
3 | /* double valeur(double a, double b, double c, double x) ; */ | ||
4 | /* Résolution d'une équation du deuxième degré */ | ||
5 | r1=(-b+s)/(2*a)+print(valeur(1,b,c,r1),valeur(1,b,c,r2)) | ||
diff --git a/res/instr.tpc b/res/instr.tpc new file mode 100644 index 0000000..7153ac2 --- /dev/null +++ b/res/instr.tpc | |||
@@ -0,0 +1,28 @@ | |||
1 | /* instr.tpc */ | ||
2 | /* int trinome(float a, float b, float c) ; | ||
3 | double valeur(double a, double b, double c, double x) ; */ | ||
4 | /* Résolution d'une équation du deuxième degré */ | ||
5 | b=-1; | ||
6 | while (b<=1) { | ||
7 | c=-1; | ||
8 | while (c<=1) { | ||
9 | print(b, c); | ||
10 | if (trinome(1,b,c)) { | ||
11 | print(r1, r2); | ||
12 | print(valeur(1,b,c,r1),valeur(1,b,c,r2)); | ||
13 | } | ||
14 | c=c+1; | ||
15 | } | ||
16 | b=b+1; | ||
17 | } | ||
18 | return 0; | ||
19 | d=b*b-4*a*c; | ||
20 | if (d>=0) { | ||
21 | s=sqrt(d); | ||
22 | r1=(-b+s)/(2*a); | ||
23 | r2=(-b-s)/(2*a); | ||
24 | return 1; | ||
25 | } | ||
26 | return 0; | ||
27 | if (0<=r1 && r1<=max && 0>=r2 && r2>=-max) | ||
28 | return; \ No newline at end of file | ||
diff --git a/res/trinome.tpc b/res/trinome.tpc new file mode 100644 index 0000000..c3e2f94 --- /dev/null +++ b/res/trinome.tpc | |||
@@ -0,0 +1,43 @@ | |||
1 | /* #include <stdio.h> | ||
2 | #include <math.h> */ | ||
3 | /* int trinome(float a, float b, float c) ; | ||
4 | double valeur(double a, double b, double c, double x) ; */ | ||
5 | /* Résolution d'une équation du deuxième degré */ | ||
6 | float r1, r2; | ||
7 | |||
8 | int main(void) { | ||
9 | int b, c; | ||
10 | b=-1; | ||
11 | while (b<=1) { | ||
12 | c=-1; | ||
13 | while (c<=1) { | ||
14 | print(b, c); | ||
15 | if (trinome(1,b,c)) { | ||
16 | print(r1, r2); | ||
17 | print(valeur(1,b,c,r1),valeur(1,b,c,r2)); | ||
18 | if (0<=r1 && r1<=max && 0>=r2 && r2>=-max) | ||
19 | return 0; | ||
20 | } | ||
21 | c=c+1; | ||
22 | } | ||
23 | b=b+1; | ||
24 | } | ||
25 | return 0; | ||
26 | } | ||
27 | |||
28 | int trinome(float a,float b, float c) { | ||
29 | float d; | ||
30 | float s; | ||
31 | d=b*b-4*a*c; | ||
32 | if (d>=0) { | ||
33 | s=sqrt(d); | ||
34 | r1=(-b+s)/(2*a); | ||
35 | r2=(-b-s)/(2*a); | ||
36 | return 1; | ||
37 | } | ||
38 | return 0; | ||
39 | } | ||
40 | |||
41 | double valeur(double a, double b, double c, double x) { | ||
42 | return a*x*x+b*x+c; | ||
43 | } \ No newline at end of file | ||