5 posts
Posted 18 January 2013 - 05:11 PM
I made a simple calculator that allows you to choose whether if you want it to repeat or not. Only accepts 2 numbers at once.
PastebinSpoiler
--[[Calculator]]--
os.loadAPI("apis/cl")
term.clear()
term.setCursorPos(1,1)
print("RobustCreepers Calculator Version 2.0")
print("Do you want the calculator to repeat? y/n")
answer = read()
if answer == "y" then
while true do
print("Do you want to add, subtract, multiply, or divide?")
op = read()
print("What is the first number to be operated on?")
num1 = read()
print("What is the second number?")
num2 = read()
if op == "add" then
textutils.slowPrint("Adding....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 + num2
print("Answer is "..ans)
sleep(2)
else
end
if op == "subtract" then
textutils.slowPrint("Subtracting....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 - num2
print("Answer is "..ans)
sleep(2)
else
end
if op == "multiply" then
textutils.slowPrint("Multipling....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 * num2
print("Answer is "..ans)
sleep(2)
else
end
if op == "divide" then
textutils.slowPrint("Dividing....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 / num2
print("Answer is "..ans)
sleep(2)
else
end
end
else
print("Do you want to add, subtract, multiply or divide?")
op = read()
print("What is the first number to be operated on?")
num1 = read()
print("What is the second number?")
num2 = read()
if op == "add" then
textutils.slowPrint("Adding....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 + num2
print("Answer is "..ans)
sleep(2)
else
end
if op == "subtract" then
textutils.slowPrint("Subtracting....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 - num2
print("Answer is "..ans)
sleep(2)
else
end
if op == "multiply" then
textutils.slowPrint("Multipling....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 * num2
print("Answer is "..ans)
sleep(2)
else
end
if op == "divide" then
textutils.slowPrint("Dividing....")
sleep(1)
term.clear()
term.setCursorPos(1,1)
ans = num1 / num2
print("Answer is "..ans)
sleep(2)
else
end
end
3790 posts
Location
Lincoln, Nebraska
Posted 18 January 2013 - 05:51 PM
That's cute...EDIT: Perhaps that was a little mean. I shouldn't be the only one with a calculator, so I retract my hurtful comment.
Anyway, good job for a simple script like this. Personally, I'm not a fan of the sleep() commands or the slowprint() commands, but overall, it does have some merit.
497 posts
Location
The Big Apple, NY
Posted 19 January 2013 - 12:58 AM
Cranium I'm not going to say that your Calculator isn't impressive (it is) but do you have to be so….mean to him
1522 posts
Location
The Netherlands
Posted 19 January 2013 - 04:52 AM
I see you got an awesome calculator there, but please dont be like this. Maybe the creator is just starting out.. This is very rude
3790 posts
Location
Lincoln, Nebraska
Posted 19 January 2013 - 04:57 AM
I see you got an awesome calculator there, but please dont be like this. Maybe the creator is just starting out.. This is very rude
Bah, I know….. I actually do like his simplicity. I tried making something like this, but then my OCD kicked in and it took me two weeks to finish what I have now.
1522 posts
Location
The Netherlands
Posted 19 January 2013 - 05:03 AM
I see you got an awesome calculator there, but please dont be like this. Maybe the creator is just starting out.. This is very rude
Bah, I know….. I actually do like his simplicity. I tried making something like this, but then my OCD kicked in and it took me two weeks to finish what I have now.
Why then the "That's cute..", you could have said like: nice program, and then check my calculator and stuff.
I mean its just polite ;P
EDIT: Sorry, I apologize. I didnt saw you edit the link think. I take this back!
497 posts
Location
The Big Apple, NY
Posted 19 January 2013 - 09:36 AM
Cranium happy u edited the post:) it's amazing the power of crossing things out….it's stays working and visible but you can't be faulted by it. It's amazing:)
Lol Jk:)
1852 posts
Location
Sweden
Posted 19 January 2013 - 10:15 AM
Well I just want to say that it is good work for a first post! :)/>
5 posts
Posted 19 January 2013 - 11:23 AM
Thank you for all the replies to my calculator. I know it isn't the best, I just wanted to make a simple calculator in a couple minutes.