aboutsummaryrefslogtreecommitdiff
path: root/res/instr.tpc
diff options
context:
space:
mode:
authorpacien2018-02-21 00:06:03 +0100
committerpacien2018-02-21 00:06:03 +0100
commitfe12fcd309812652abbdf140c67f9986a1967461 (patch)
tree1f95f89c8d12a2cf99b93af1f26a760a934cca28 /res/instr.tpc
parent999ea6eac4735cfaf540bed392fb6b5473e3ebdc (diff)
downloadtpc-compiler-fe12fcd309812652abbdf140c67f9986a1967461.tar.gz
Add sample TPC sources
Diffstat (limited to 'res/instr.tpc')
-rw-r--r--res/instr.tpc28
1 files changed, 28 insertions, 0 deletions
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