2002-02-26 12:19:02 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include "gm.h"
|
|
|
|
void ErrorHandler(int,int);
|
2003-05-01 14:42:54 +00:00
|
|
|
int main(void);
|
2002-02-26 12:19:02 +00:00
|
|
|
|
|
|
|
void ErrorHandler(code,ref)
|
|
|
|
int code,ref;
|
|
|
|
{
|
|
|
|
char serr[15],sfun[32];
|
|
|
|
ErrorName(serr, code);
|
|
|
|
FunctionName(sfun, ref);
|
|
|
|
printf("%s error in function %s\n",serr,sfun);
|
|
|
|
}
|
|
|
|
|
2003-05-01 14:42:54 +00:00
|
|
|
int main()
|
2002-02-26 12:19:02 +00:00
|
|
|
{
|
|
|
|
DEC da, *a=&da, db, *b=&db, dc, *c=&dc, *p;
|
|
|
|
|
|
|
|
SetMathErrVector(ErrorHandler);
|
|
|
|
|
|
|
|
ZeroDecimal(a);
|
|
|
|
ZeroDecimal(b);
|
|
|
|
ZeroDecimal(c);
|
|
|
|
|
|
|
|
dprintf("First number: ");
|
|
|
|
dscanf("%.2t",a);
|
|
|
|
dprintf("Second number: ");
|
|
|
|
dscanf("%.2t",b);
|
|
|
|
p = DivideDecimalAndRound(c,a,b,2);
|
|
|
|
if (p)
|
|
|
|
dprintf("%t / %t = %t\n",a,b,c);
|
|
|
|
else
|
|
|
|
dprintf("Division failed.\n");
|
2003-05-01 14:42:54 +00:00
|
|
|
return 0;
|
2002-02-26 12:19:02 +00:00
|
|
|
}
|