Basic calculator!

 BBS: Inland Empire Archive
Date: 04-03-93 (17:22)             Number: 375
From: MICHEL BERTLER               Refer#: NONE
  To: GEOFFREY LIU                  Recvd: NO  
Subj: Basic calculator!              Conf: (2) Quik_Bas
Hello Geoffrey!

I've found this old but still working basic calculator with arithmetic,
trig and log operation. Here it is in a Postit script:

------ CLS:?STRING$(50,178):DEFINT A-Z 'Created by PostIt! v5.1 Y$="*+,-./":FOR A=0 TO 6:P(A)=2^A:NEXT:OPEN "B",1,"RPN.ARJ T$="abcdefghijklmnopqrstuvwxyz":T$=T$+UCASE$(T$)+"0123456789() G"GP(ja4bbb*eaiaRSg5GA///+ifuo5sqsPe*qpgiee+M6Na G"Ghee*qe*SgZDdQHue+kQ+S9pqWk+c+Guq5Klcf0u+(f8en*WaTU2Mvxdj G"Z9bzC7PW(VHzBBLQayH2OKSEIY6BwaApQeUMFvJiqLQsYZVC))VhguBN2St0Dn5MgQjnCN G"hHtZuhVPpa3TrGmeXWQIZjwcw00KRPd(Z1OlSAMGbm86mhy9IVyVsAcsDvWy87Z8yPRM0G G"doaVHGTkMk5Cmf5BT6e(xS5qSF78Q7iE0EefW8efY2ri9L4giJ0YxqOwPj0yIDHqqq79Ql G"4yei9Y5eDBSxKEuIfPXCVRS5nWnIEzPkG7eFa0bYJeMDbvOFJTGylHtqG8e2VPpibrr1dI G"ogIe5mhw1qziPe7coqBjtukdI1)CMR6mDLX2gDxuD(oq(gI9S42ugLgZszZBJyO(i5Tb0p G"SWiz6KTmdMOViOip2D70xql(yJqk(Bm6XBr(6VQKUSye)C2(HFv5IwgVnF2VW4KfJolOsa G"CrJMWnPv4v(H4gdobncjDMwtBViSYE7MC3Kvd54Sj1xKM)(2ptSG(oLzyomnGSmfsWqMto G"mDGybJGzoENas8yw3W8ebsDyS8o0VrBICtH5sjwcpZBuVMMd3wAZ8H3KrFsH0hL3gW(SoE G"EXwm12h7w8I1ZEfnwrBO7uicdKbbmGEfCZ3kCVG7XzGpg4YKmh020EOQIoa2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bad checksum!":END G:I=I+1:T=INSTR(T$,MID$(C$,I,1))-1:C=(C+T)*2:C=C\256+(C AND 255):RETURN SUB G(A$):SHARED C$,Y$:FOR Q=1 TO 6:DO:S=INSTR(A$,CHR$(Q+41)) IF S THEN A$=LEFT$(A$,S-1)+STRING$(Q+1,97)+MID$(A$,S+1) LOOP WHILE S:NEXT:C$=C$+A$:END SUB
------ Example: To solve 8/2 you enter: 8 <CR> 2 (The operation must always be entered at last) The final result will reside in the first stack while the second, third and fourth are used for shifting values <cr> upward or <d> downward. So, entering 8 <cr> followed by 2 will make the display look as follows: use <CR> for enter * for multiplication / for division Q for square root 0.00000000000 S for sine 0.00000000000 C for cosine 0.00000000000 T for tangent 8.00000000000 E for e to the x N for log(e) x 2 L for log(10) x D to delete entry <Esc> to end program and pressing / 50 <=== This number appearing at the bottom/left corner of the screen is the scan code of any key beeing pressed. use <CR> for enter * for multiplication / for division Q for square root 0.00000000000 S for sine 0.00000000000 C for cosine 0.00000000000 T for tangent 4.00000000000 E for e to the x N for log(e) x L for log(10) x D to delete entry <Esc> to end program Michel --- GoldED * Origin: Blainville, Quebec (1:242/130)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET