1

I have written a program that simplifies a radical, but it's kind of ugly and I am interested in "prettying" up the interface:

prgmSIMPRAD
IN?
R=?48
OUT:
                        4
IN:
                        3
                     DONE

Ideally I'd like something like this:

prgmSIMPRAD(48)
       4(radical symbol)3

After a quick google I figured out how to beautify the answer, but I'm still curious if it is possible to put a parameter in the call to the program.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Tako M.
  • 295
  • 1
  • 3
  • 13

3 Answers3

2

From what I know, this is not possible with any actual features of how the interpreter executes the program (no system variable for arguments or syntax for it as a command, but I could be wrong). You can however do something like this:

48:prgmSIMPRAD

This will pass 48 directly into the Ans system variable, and then execute the program (: is just a new line pretty much). Obviously many other things will set stuff to the Ans variable, so you'll want to store it right off the bat like:

Ans->A
//code here
Lemon Drop
  • 2,113
  • 2
  • 19
  • 34
0

This answers the text formatting question: http://tibasicdev.wikidot.com/forum/t-601799/radical-simplifying

Input "√(",A
iPart(√(A                ;This is where we start testing for factors of A
While fPart(A/Ans²       ;repeat so long as Ans² does not perfectly divide A
Ans-1                    ;Since the previous number was not a square factor, go to the next
End
Text(0,0,Ans,"√(",A/Ans²,")
Tako M.
  • 295
  • 1
  • 3
  • 13
0

You can do just that by using the beauty that is the Output( command.

You can go about this by counting digits of both numbers (see documentation for log(), using If commands to check if either number is zero, and of course, displaying √( as string.

user3932000
  • 671
  • 8
  • 24