示例#1
0
void main()
{
	pDICT root =NULL;
	int iChoice =1;
	int Count;
	while(iChoice !=0)
	{
		system("cls");
		printf("\t1.Create your Dictionary.\n");
		printf("\t2.Load Dictionary.\n");
		printf("\t3.Look up word.\n");
		printf("\t4.Delete word.\n");
		scanf("%d", &iChoice);
		fflush(stdin);
		switch(iChoice)
		{
		case 1:
			root = MakeDictionary();  
			break;
		case 2: 
			PrintDictionary(root);
			Count = CountWord(root);
			printf("Dictionary have %d word.\n",Count);	
			break;
		case 3:
			LookUpWord(root);
			break;
		case 4: 
			DeleteWord(root);
			break;
		}
		getch();
	}
}
示例#2
0
/* printing functions */
void PrintValue(VALUE value)
{
    switch (value.type)
    {
        case VAL_PRIMITIVE: 
//#ifdef WIN32
//            printf("%l64i", value.data.primitive); 
//#else
            printf("%lli", value.data.primitive); 
//#endif
            break;
        case VAL_FLOATING_POINT: 
            if (_SUPPORTS_80BIT_FLOATING_POINT)
            {
                printf("%.18Lg", value.data.floatp);
                break;
            } else {
                printf("%.16Lg", value.data.floatp); 
                break;
            }
        case VAL_STRING: printf("%s", value.data.string); break;
        case VAL_REFERENCE: PrintObject(value.data.reference); break;
        case VAL_FUNCTION: PrintFunction(value.data.function); break;
        case VAL_DICTIONARY: PrintDictionary(value.data.dictionary); break;
    default:
        case VAL_NIL: printf("[NIL]"); break;
    }
}