Exponentiation with infix operators in (or operating on) the base: Difference between revisions

Applesoft BASIC
(Exponentiation with infix operators in (or operating on) the base in various BASIC dialents (BASIC256, Gambas, QBasic, Run BASIC, True BASIC, PureBasic, XBasic and Yabasic))
(Applesoft BASIC)
Line 187:
 
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<lang gwbasic>S$=" ":M$=CHR$(13):?M$" X P -X^P -(X)^P (-X)^P -(X^P)":FORX=-5TO+5STEP10:FORP=2TO3:?M$MID$("+",1+(X<0));X" "PRIGHT$(S$+STR$(-X^P),8)RIGHT$(S$+STR$(-(X)^P),8)RIGHT$(S$+STR$((-X)^P),8)RIGHT$(S$+STR$(-(X^P)),8);:NEXTP,X</lang>
{{out}}
<pre>
 
X P -X^P -(X)^P (-X)^P -(X^P)
 
-5 2 25 25 25 -25
-5 3 125 125 125 125
+5 2 25 25 25 -25
+5 3 -125 -125 -125 -125
</pre>
==={{header|BASIC256}}===
<lang BASIC256>print " x p | -x^p -(x)^p (-x)^p -(x^p)"
413

edits