From 829952e6425131abf0199158d63a68d1e075ddc8 Mon Sep 17 00:00:00 2001 From: Doni Pracner Date: Wed, 12 Feb 2014 12:07:13 +0100 Subject: [PATCH] polinoml - dodat mali test program za postaviclan --- kodovi/polinomi/testpoli.MOD | 110 +++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 kodovi/polinomi/testpoli.MOD diff --git a/kodovi/polinomi/testpoli.MOD b/kodovi/polinomi/testpoli.MOD new file mode 100644 index 0000000..12d3960 --- /dev/null +++ b/kodovi/polinomi/testpoli.MOD @@ -0,0 +1,110 @@ +MODULE testpoli; +FROM PolinomL IMPORT Polinom, Stampaj, Anuliraj, + DisposePolinom, PostaviClan, Kopiraj; +FROM InOut IMPORT WriteString, WriteLn; + +VAR + q,q2 : Polinom; + +BEGIN + (* korisnik unosi prvi polinom *) + WriteString("Unesite polinom:"); + WriteLn; + Anuliraj(q); + (* postavimo clan x^5 *) + PostaviClan(1.0,5,q); + (* -3 x^4 *) + PostaviClan(-3.0,4,q); + (* 4 x *) + PostaviClan(4.0,1,q); + (* 7 (x^0) *) + PostaviClan(7.0,0,q); + + WriteString("q: ");WriteLn; + Stampaj(q,0); + WriteLn; + + WriteString("dodaj u sredinu"); + WriteLn; + PostaviClan(2.0,2,q); + Stampaj(q,0); + WriteLn; + + WriteString("nula prvi"); + WriteLn; + PostaviClan(0.0,5,q); + Stampaj(q,0); + WriteLn; + + WriteString("nula poslednji"); + WriteLn; + PostaviClan(0.0,0,q); + Stampaj(q,0); + WriteLn; + + WriteString("nula sredina"); + WriteLn; + PostaviClan(0.0,2,q); + Stampaj(q,0); + WriteLn; + + WriteString("nula nepostojeci"); + WriteLn; + PostaviClan(0.0,2,q); + Stampaj(q,0); + WriteLn; + + WriteString("postavi prvi"); + WriteLn; + PostaviClan(7.0,7,q); + Stampaj(q,0); + WriteLn; + + WriteString("postavi poslednji"); + WriteLn; + PostaviClan(7.0,1,q); + Stampaj(q,0); + WriteLn; + + Kopiraj(q,q2); + + WriteString("dodaj srednji u listu duzine 2"); + WriteLn; + PostaviClan(11.0,3,q); + Stampaj(q,0); + WriteLn; + + Kopiraj(q2,q); + WriteString("obrisi prvi iz liste duzine 2"); + WriteLn; + PostaviClan(0.0,7,q); + Stampaj(q,0); + WriteLn; + + WriteString("obrisi prvi iz liste duzine 1"); + WriteLn; + PostaviClan(0.0,1,q); + Stampaj(q,0); + WriteLn; + + Kopiraj(q2,q); + WriteString("obrisi poslednji iz liste duzine 2"); + WriteLn; + PostaviClan(0.0,1,q); + Stampaj(q,0); + WriteLn; + + WriteString("obrisi poslednji iz liste duzine 1"); + WriteLn; + PostaviClan(0.0,7,q); + Stampaj(q,0); + WriteLn; + + WriteString("nuliranje u listi duzine 0"); + WriteLn; + PostaviClan(0.0,7,q); + Stampaj(q,0); + WriteLn; + + DisposePolinom(q); +END testpoli. -- 2.25.1