?? supp.c
字號:
#include <stdio.h>#include <stdlib.h>#include <string.h>#include "supp.h"#define STACKSIZE 1024char *unit1[] = { "", "拾", "佰", "仟" };char *unit2[] = { "", "萬", "億" };char *digital[] = { "零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖" };typedef struct meta { int value; int type;} META;META stack[STACKSIZE];int language = 0;int sp = -1;int setlang(int lang){ language = lang; return OK;}int dump (){ int i; int v,t; for (i = sp; i>=0; i--) { v = stack[i].value; t = stack[i].type; if (i==sp && (t >0 || (t ==0 && v ==0))) continue; switch (t) { case 0: printf ("%s", digital[v]); break; case 1: printf ("%s", unit1[v]); break; case 2: printf ("%s", unit2[v]); break; } } printf ("\n"); return OK;}int push (int value, int type){ int v; int t; int ret; if (value == 0 && type ==0) { ret = pickup (&v, &t); if ( (v ==0) || ret || t>1) return EUNKNOWN; } if (type == 2) { ret = pickup (&v, &t); if (t == 2 && v < value) drop (); } if (++sp >= STACKSIZE) return EOVER; stack[sp].value = value; stack[sp].type = type; return OK;}int pop (int *value, int *type){ if (sp < 0) return EEMPTY; *value = stack[sp].value; *type = stack[sp].type; sp --; return OK;}int cleanstack (){ sp = -1; return OK;}int drop (){ if (sp < 0) return EEMPTY; sp --; return OK;}int pickup(int *value, int *type){ if (sp < 0) return EEMPTY; *value = stack[sp].value; *type = stack[sp].type; return OK;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -