The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 795 - File: showthread.php PHP 7.4.33 (FreeBSD)
File Line Function
/showthread.php 795 errorHandler->error





Post Reply 
Custom Text Formatting (Previously: Getting long results in a program)
03-18-2024, 08:37 PM (This post was last modified: 04-16-2024 01:08 PM by matalog.)
Post: #1
Custom Text Formatting (Previously: Getting long results in a program)
(Subject edited to suit the progression of the thread)

I have this little program
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.

I guess I would have to use CAS to get those results?

Any tips on converting this program to get the results I want?
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Custom Text Formatting (Previously: Getting long results in a program) - matalog - 03-18-2024 08:37 PM
RE: Custom Text Formatting - Tyann - 04-15-2024, 06:55 PM
RE: Custom Text Formatting - komame - 04-15-2024, 07:42 PM
RE: Custom Text Formatting - Tyann - 04-16-2024, 04:38 AM
RE: Custom Text Formatting - komame - 04-16-2024, 06:02 AM



User(s) browsing this thread: 68 Guest(s)