Hey people! Guess what today is...SATURDAY!!! Today we...uh...hurt our brains with tastes of THOLITU! In case you haven't heard, I'm making another interpreted language called THOLITU, which stands for The Hardest Obfuscated Language in the Universe! That should say something. Its main point is to be, well, what the name stands for. The only real good thing about it is that code can be very compact. Anyway, I'll be making a simple calculator! You enter 2 numbers, and it will add, subtract, multiply, divide, exponentialize, and find the modulus if all the numbers entered, and return the answers. I'll also post the SmileBASIC, C++, and SimpleC equilavents.
In THOLITU:
-<{Enter 2 numbers:}|
->*X
->*Y
x+[*X:*Y]~*<+>=%{A}
x+[*X:*Y]~*<->=%{S}
x+[*X:*Y]~*<*>=%{M}
x+[*X:*Y]~*</>=%{D}
x+[*X:*Y]~*<^>=%{E}
x+[*X:*Y]~*<%>=%{m}
-<&%*X{+}&%*Y{=}&%*A|
-<&%*X{-}&%*Y{=}&%*S|
-<&%*X{*}&%*Y{=}&%*M|
-<&%*X{/}&%*Y{=}&%*D|
-<&%*X{^}&%*Y{=}&%*E|
-<&%*X{%}&%*Y{=}&%*m||
-<{Press B to exit.}
!O{60}>B@32
>|
In SmileBASIC:
PRINT"Enter 2 numbers:"
INPUT X
INPUT Y
A=X+Y
S=X-Y
M=X*Y
D=X/Y
E=POW(X,Y)
MO=X%Y
PRINT X "+" Y "=" A
PRINT X "-" Y "=" S
PRINT X "*" Y "=" M
PRINT X "/" Y "=" D
PRINT X "^" Y "=" E
PRINT X "%" Y "=" MO
PRINT ""
PRINT "Press B to exit."
@ENDLOOP
IF !(BUTTON() AND 32) THEN @ENDLOOP
END
In C++:
#include <iostream>
#include <conio.h>
using namespace std;
int main(void)
{
int x,y,a,s,m,d;
//I don't know exponents or modulus in C++
cout<<"Enter 2 numbers:\n";
cin>>x;
cin>>y;
a=x+y;
s=x-y;
m=x*y;
d=x/y;
cout<<x<<"+"<<y<<"="<<a<<"\n";
cout<<x<<"-"<<y<<"="<<s<<"\n";
cout<<x<<"*"<<y<<"="<<m<<"\n";
cout<<x<<"/"<<y<<"="<<d<<"\n\n";
cin.ignore();
cout<<"Press any key to exit."
getch();
return 0;
}
In SimpleC:
OUT<"Enter 2 numbers:\n"
IN> VAR[X]
IN> VAR[Y]
MATH A=X+Y
MATH S=X-Y
MATH M=X*Y
MATH D=X/Y
MATH E=X^Y
'You cannot do modulus in SimpleC
'Prepare for fun with output!
OUT<VAR[X]
OUT<"+"
OUT<VAR[Y]
OUT<"="
OUT<VAR[A]
OUT<"\n"
OUT<VAR[X]
OUT<"-"
OUT<VAR[Y]
OUT<"="
OUT<VAR[S]
OUT<"\n"
OUT<VAR[X]
OUT<"*"
OUT<VAR[Y]
OUT<"="
OUT<VAR[M]
OUT<"\n"
OUT<VAR[X]
OUT<"/"
OUT<VAR[Y]
OUT<"="
OUT<VAR[D]
OUT<"\n"
OUT<VAR[X]
OUT<"^"
OUT<VAR[Y]
OUT<"="
OUT<VAR[E]
OUT<"\n"
OUT<"\n"
OUT<"Press B to exit."
SLP[BUT[32]]
STOP