From 3a27bd0b8a80beae30442868f3c89f0c464ac3cb Mon Sep 17 00:00:00 2001 From: hackbard Date: Thu, 4 Apr 2002 18:04:30 +0000 Subject: [PATCH] added 3 c progs: fehler.c, histp.c, layout.c --- fehler.c | 24 ++++++++++++++++++++++++ histo.c | 27 +++++++++++++++++++++++++++ layout.c | 12 ++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 fehler.c create mode 100644 histo.c create mode 100644 layout.c diff --git a/fehler.c b/fehler.c new file mode 100644 index 0000000..0eaa015 --- /dev/null +++ b/fehler.c @@ -0,0 +1,24 @@ +#include +#include + +#define VARIABLEN_TYP double +#define MAX_ 40 + +main() +{ +VARIABLEN_TYP erg, x1, x2; +int i; + +x1=30; +x2=25; + +printf("1 Ergebnis: 30"); +printf("2 Ergebnis: 25"); + +for (i=3;i<=MAX_;++i) + { + printf("%02d. Ergebnis: %08.2f\texakt: %f\n",i,erg=(-13*x2/6)+(5*x1/2),36.*pow((5./6),i)); + x1=x2; + x2=erg; + } +} diff --git a/histo.c b/histo.c new file mode 100644 index 0000000..927d663 --- /dev/null +++ b/histo.c @@ -0,0 +1,27 @@ +#define BREITE 81 +#define HOEHE 24 +#define FUNKTION y=(x-8)*(x-8)-10 +#include +#include +#include + +int x,y,i; +char z; + +int main(void) +{ +for(i=0;i++0)?(z='+'):(z='-')); + printf("%02d",x); + if (y>BREITE-3) {y=BREITE-3;z='*';} + for(;y-->1;printf(" ")); + printf("%c\n",z); + } +return(0); +} diff --git a/layout.c b/layout.c new file mode 100644 index 0000000..5c53c24 --- /dev/null +++ b/layout.c @@ -0,0 +1,12 @@ +#include +#include + +main() +{ + +float x; + +printf(" x | f(x) \n__________________\n"); +for (x=0;x<10;x=x+.1) + printf(" %3.1f | %010.3f \n",x,x*exp(x)); +} -- 2.20.1