campo-sirio/gfm/demo12.c
alex 0688668ef5 Patch level : 2.0 464
Files correlati     : gfm.dll
Ricompilazione Demo : [ ]
Commento            :
Modifiche per la compilazione Linux


git-svn-id: svn://10.65.10.50/trunk@11079 c028cbd2-c16b-5b4b-a496-9718f37d4682
2003-05-01 14:42:54 +00:00

45 lines
698 B
C
Executable File

#include <stdio.h>
#include "gm.h"
void SmartScan(char *,DEC *);
void main(void);
void main()
{
DECP x;
SmartScan("Type a number: ", x);
PrintDecimal("You typed a %t\n", x);
}
void SmartScan(s, pd)
char *s;
DEC *pd;
{
short done;
int i;
if (!pd) {
printf("Error: null DEC pointer\n");
return;
}
ClearMathError();
done=FALSE;
while (!done) {
printf("%s",s);
ScanDecimal("%t",pd);
i = ReturnMathErrAndClear();
if (i==GM_SUCCESS)
done=TRUE;
if (i==GM_CNVRW) {
done=TRUE;
printf("Warning: Digit loss due to rounding\n");
}
if (i==GM_CNVRE)
printf("Error: Number out of range\n");
if (i==GM_NAN)
printf("Error: Not a number\n");
}
return;
}