/*********************Matheprogramm********************************************/
#include <stdlib.h>
#include <time.h>
#include <conio.h>
#include <stdio.h>
void main (void)
{
double zahl1,zahl2,hoch,summe,summe2,ergebnis,ergeb2,hoch2,x=1;
char eingabe;
while (x != 0)
{
clrscr();
fflush(stdin);
textcolor (1+128);
cprintf("\n\n C L E V E R S O F T");
cprintf("\n\n M A T H E T E S T ");
textcolor (3);
printf("\n\n\n\n\n\tGib ein bis zu welcher Zahl Du rechnen kannst :");
scanf("%lf",&hoch);
clrscr();
printf("\n\tMoechtest Du zusammenzaehlen oder abziehen ?");
printf("\n\n\tgib (+) ein zum zusammenzaehlen .");
printf("\n\n\tgib (-) ein zum abziehen .");
eingabe=getch();
switch (eingabe)
{
case '+':
clrscr();
randomize ();
zahl1 = random (hoch);
hoch2 = hoch - zahl1;
zahl2 = random (hoch2);
summe2=zahl1 + zahl2;
summe=9999;
while (summe != summe2)
{
summe=9999;
printf("\n\n\tDie Aufgabe lautet : %4.0lf + %4.0lf = ?",zahl1,zahl2);
printf("\n\n\tGib das Ergebnis ein : ");
scanf("%lf",&summe);
if (summe < summe2)
printf("\n\t%4.0lf ist zu < !",summe);
if (summe > summe2)
printf("\n\t%4.0lf ist zu > !",summe);
}
break;
case '-':
clrscr();
randomize ();
zahl1 = random (hoch);
zahl2 = random (zahl1);
ergeb2 = zahl1 - zahl2;
ergebnis=9999;
while (ergebnis != ergeb2)
{
ergebnis=9999;
printf("\n\n\tDie Aufgabe lautet : %4.0lf - %4.0lf = ?",zahl1,zahl2);
printf("\n\n\tGib das Ergebnis ein : ");
scanf("%lf",&ergebnis);
if (ergebnis < ergeb2)
printf("\n\t%4.0lf ist zu < !",ergebnis);
if (ergebnis > ergeb2)
printf("\n\t%4.0lf ist zu > !",ergebnis);
}
break;
}
textcolor (4+128);
cprintf("\n\n Richtig");
textcolor (2+128);
cprintf("\n\n\ Gratuliere !!!");
textcolor (3);
printf("\n\n\n\n\n\n\tWeiter (1) ");
printf("\tAufhoeren (0) \n\t");
scanf("%lf",&x);
}
}