From fe12fcd309812652abbdf140c67f9986a1967461 Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 21 Feb 2018 00:06:03 +0100 Subject: Add sample TPC sources --- res/instr.tpc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 res/instr.tpc (limited to 'res/instr.tpc') 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 @@ +/* instr.tpc */ +/* int trinome(float a, float b, float c) ; + double valeur(double a, double b, double c, double x) ; */ +/* Résolution d'une équation du deuxième degré */ + b=-1; + while (b<=1) { + c=-1; + while (c<=1) { + print(b, c); + if (trinome(1,b,c)) { + print(r1, r2); + print(valeur(1,b,c,r1),valeur(1,b,c,r2)); + } + c=c+1; + } + b=b+1; + } + return 0; + d=b*b-4*a*c; + if (d>=0) { + s=sqrt(d); + r1=(-b+s)/(2*a); + r2=(-b-s)/(2*a); + return 1; + } + return 0; + if (0<=r1 && r1<=max && 0>=r2 && r2>=-max) + return; \ No newline at end of file -- cgit v1.2.3