Files correlati : Ricompilazione Demo : [ ] Commento : Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll) git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			36 lines
		
	
	
		
			617 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			617 B
		
	
	
	
		
			C
		
	
	
		
			Executable File
		
	
	
	
	
| #include <stdio.h>
 | |
| #include "gm.h"
 | |
| void main(void);
 | |
| 
 | |
| void	main()
 | |
| {
 | |
| 	DEC	da, *a=&da, db, *b=&db;
 | |
| 	DEC	*f;
 | |
| 	char	s[30];
 | |
| 	int	prec;
 | |
| 	
 | |
| 	do  {
 | |
| 		printf("Type a number:  ");
 | |
| 		scanf("%s",s);
 | |
| 		f = ConvAsciiToDecimal(a,s);
 | |
| 	} while (f == GM_NULL);
 | |
| 	
 | |
| 	printf("Round to how many decimal places? ");
 | |
| 	scanf("%d", &prec);
 | |
| 
 | |
| 	f = RoundDecimal(b, a, prec);
 | |
| 	if (f)  {
 | |
| 		ConvDecimalToAscii(s, b);
 | |
| 		printf("  Rounding yields %s\n", s);
 | |
| 	}
 | |
| 	else
 | |
| 		printf("Rounding failed\n");
 | |
| 
 | |
| 	f = TruncateDecimal(b, a, prec);
 | |
| 	if (f)  {
 | |
| 		ConvDecimalToAscii(s, b);
 | |
| 		printf("Truncation yields %s\n", s);
 | |
| 	}
 | |
| 	else
 | |
| 		printf("Truncating failed\n");
 | |
| } |