0688668ef5
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
45 lines
698 B
C
Executable File
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;
|
|
}
|