An actual good calculator
There are like a BAJILLION posts on replit that are "calculators" that go like this:
Please input which operation you would like: Plus, minus, add, or divide
Please input which numbers you would like to add.
I got bored of those, and I made a calculator where you can just straight up input the expression you want to calculate. Works with +,-,*,/,^ for exponent, and parentheses! Not only that it follows order of operations too. It even has decimal capability of 10 places. Also, no eval() function.
The purpose of this post? To make a calculator where you can just enter your math expression instead of printing "Plus, minus, multiply or divide?" without using eval.
also to prove that stacks are useful because basically no posts on replit use stacks
EDIT: Y'all are razzing on me because my calculator doesn't work for super big numbers or if you just input gibberish. But seriously there is a thing called integer limit... sigh
UPDATE: Floor division has been added.
@tussiez sigh, yall are razzing on me for having "bad math" but no other calculator on replit can handle big numbers, equations, and random letters. At least my calculator allows you to straight up enter an expression and it follows pemdas instead of other basic calculators that can literally do one operation.
Hi, this is really random but do you do competitive programming? I think I saw it in a comment somewhere
@FlaminHotValdez Yeah, I'm in Canada. First we have the Canadian Computing Competition (CCC). Each year there's about 7000 participants. If you get around top 20, then you're invited to the Canadian Computing Olympiad (CCO). The top 4 from the CCO go to the International Olympiad of Informatics (IOI) 👀.
Last year I was like bottom 6000 in Canada lol. But this year I was top 731. And next year, which will be my last year, I'm really hoping to be top 20 to get into the CCO 🙏
@DynamicSquid Cool! In the USA, we have the USACO(United States of America Computing Olympiad), which is split into 4 tiers. Bronze, silver, gold, and platinum. You start out at bronze. When you take the contest, you take the contest respective to your tier, and if you do well(Usually 75%), you advance to the next tier. The USACO contests are held four times a year. Once in December, once in January, and once in February. Then there's the one called the "US Open." It usually takes place in March, but this year it happened in early April. The questions on the US Open are harder than the other contests, and the top 20-ish scorers from Platinum in the US Open advance to a "camp" of sorts. Then, the top 4 in the "camp" are chosen to go to the IOI. Last year in February, I advanced from bronze to silver. And I've been stuck on the silver for 5 contests straight. They say it's the biggest jump between levels.
EDIT: If you read through that entire paragraph I apologize on behalf of your eyes.
You just made a parser(not a very good one tbh) and an evaluator.
IT'S STILL COOL THO!!!
@StrangeQuarkAL The point of this was to make a calculator that could actually parse expressions and evaluate them correctly without using eval() function and similar. So yeah. The vast majority of calculators on repl.it neither parse nor evaluate without using the eval() function so I consider this an accomplishment.
Actually, why do you have to make this. I AM RAGED, I AM DOING THIS TOO. WHYYYYYY. I AM DOING THE SAME THING RIGHT NOW!!!! YOU WASTED MY PROGRAM. UGGGGGGG
Well I was making a calculator just for fun anyway. I was not planning to share it until recently. I won't share it. But I AM STILL THE ONE TO MAKE THE TUTORIALS. I MADE THE FIRST TUTORIAL ALREADY AND YOU ARE NOT ALLOWED TO MAKE A TUTORIAL ON THIS!!! I BAN YOU!!! but actually bruh i am making tutorials on how to make calculators in C++ so please let me do that at least(I made my first one already check it out in the new area of tutorials) @FlaminHotValdez
Well duh. Why tf would cycles matter @Whippingdot.
I mean I used to be a 3 cycles dude who posted crud projects. 200 cycles is a lot.
I dont care about cycles for respect, if youre a trusted member (u are :D) of Replit or I trust you I pay attention.
If you think cycles = respect, thats wrong. tbh it makes people farm cycles.
I do python and H, C, J. I have no idea how C++ works and for some reason I can’t get to is to load. But judging by the code, this is good. And I mean good. Like I made a pretty good calculator with H, C, J recently (shameless self promotion: go check that out) and that one was far far better than the tiny spammed console ones. But order of operations must add a whole knew layer of complexity. I applaud this.