Code:
EXPORT unitex()
BEGIN
LOCAL KEYS:={"","","","","","","","","","","","","","","","","","","","","","","i","","","^2","m","n",",","","p","7","8","9","/","Ans(","4","5","6","*","","1","2","3","-","","0","."," ","+"};
LOCAL SKEYS:={"","","","","","","","","","","","","","a","b","c","d","e","","f","g","h","i","j","k","l","m","n","o","","p","q","r","s","t","","u","v","w","x","","y","z","#","-","","0","."," ","+"};
LOCAL Result:={"exa","peta","tera","giga","mega","kilo","","milli","micro","nano","pico","femto","atto"};
LOCAL K;
LOCAL F:=0;
LOCAL X:=0;
LOCAL Y:=222;
LOCAL C:="";
LOCAL oC:="";
LOCAL tC:="";
LOCAL Z:=0;
LOCAL flo:=0;
LOCAL stc:=0;
LOCAL lis:=0;
LOCAL mult:=0;
LOCAL SHIFT:=0;
LOCAL num:=5;
RECT_P(16777215);
RECT_P(0,0,320,12,0,0);
TEXTOUT_P("UNIT EXPANDER",103,0,0,16777215);
REPEAT
oC:=C;
K:=-1;
WAIT(-1);
FOR F FROM 0 TO 50 DO
IF ISKEYDOWN(F) THEN K:=F END;
END;
IF K ≥ 0 THEN
IF SHIFT=1 THEN
C:=C+SKEYS(K);
ELSE
C:=C+KEYS(K);
END;
RECT_P(0,227,320,240,16777215,16777215);
TEXTOUT_P(C,2,228,0,0);
IF size(C)>17 THEN
C:=oC;
END;
mult:=0;
IF size(C)>1 THEN
IF C(size(C))>57 THEN
IF C(size(C),1)="m" THEN
mult:=-3;
END;
IF C(size(C),1)="u" THEN
mult:=-6;
END;
IF C(size(C),1)="n" THEN
mult:=-9;
END;
IF C(size(C),1)="p" THEN
mult:=-12;
END;
num:=EXPR(LEFT(C,size(C)-1));
ELSE
num:=EXPR(C);
END;
END;
num:=num*10^mult;
IF K=19 THEN // DELETE
IF size(C)<2 THEN
C:="";
END;
IF size(C)>1 THEN
C:=LEFT(C,size(C)-1);
END;
RECT_P(0,227,320,240,16777215,16777215);
TEXTOUT_P(C,2,228,0,0);
END;
X:=size(C)*7;
IF K=30 THEN // ENTER
IF C≠"" THEN
tC:=C;
RECT_P(0,13,320,240,16777215,16777215);
FOR lis FROM 1 TO 13 DO
TEXTOUT_P(string(num*(10^((lis-7)*3)))+" "+Result(lis) ,2,lis*13,0,0);
END;
RECT_P(0,227,320,240,16777215,16777215);
TEXTOUT_P(C,2,228,0,0);
END;
END;
IF K=41 THEN
SHIFT:=NOT SHIFT;
END;
END;
UNTIL K == 4;
END;
And I would like it to output as many zeroes as it has to to avoid E type results on screen.