Simple Calculator

Discussion in 'Share Your Creations' started by RandomCoder, Nov 1, 2007.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Well here it is, my attempt at a simple calculator.
    Hope it's OK.

    I've kept is simple and tried to keep the code to a minimum.
    As normal it doesn't quite display the same on the desktop as it does on the device. The text on the buttons is larger on the desktop.


    Attached Files:

  2. specci48

    specci48 Well-Known Member Licensed User

    Simple is often better than complex (or overload). ;)

    But everyone should be aware: this attempt doesn't support the simpliest mathematical rules (calculate * or / before + or -).
    2 + 3 * 4 results in 20 instead of the correct 14.

    If I were in the jury of the competition, I would give zero points... :sign0013:

    But I'm sure really can do it better... :sign0152:
  3. Erel

    Erel Administrator Staff Member Licensed User

    Non-scientific calculators do not obey these rules.
    You can check for example the windows calculator in standard mode.
  4. Cableguy

    Cableguy Expert Licensed User

    The basical calculator doesnt do the operation in the "matematical" order, but in the input order...
    So does RandomCoder's, I give full points to it...
    The rules stated "a working calculator" ( maybe not to the letter...), and this one is one!!
  5. taximania

    taximania Well-Known Member Licensed User

    I'm well impressed by it :sign0188:

    The troubles :sign0148: with my last attempt at coding, and :signOops: (Endemol), has sort of held/put me off coding, hence, I didn't even attempt a go at a calculator. I still can't believe I've got the code for a good app but it's :sign0079:

    Nice one Random :)
  6. specci48

    specci48 Well-Known Member Licensed User

    Ok, but I think we all are really basic4ppc scientifics. So the calculator should behave like one... :)
  7. Cableguy

    Cableguy Expert Licensed User

    I have to say that I dindt get around to code my calculator....Thougth I had some cool ideas, like skinneable, lcd display look, omong others...

    I guess that waht you are trying to say is that we all expected a more "professional" aproch to the competition, but I have to say, that most of us code for fun, and only a few for money, and we can count by hand the ones that code for personal profit...

    Competiotion is just a way of showing what we have learn, and see how other people deal with the "exact" same problem...

    To me, anyone that could finish their calculator in time is a winner, as long as it gives 2+2=4
  8. specci48

    specci48 Well-Known Member Licensed User



    But if we call it a competition, I think it should be possible to value an attempt. It was my personal view and as I said, I am sure that RandomCoder could do very, very much better.

    If I made someone angry, especially you RandomCoder :sign0013:
  9. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Specci48, my friend you have not angered me or anyone with your comments :)

    I initially wanted to make my calculator work as Erel's example does, in that you write the expression in full and then hit solve and out pops a result.
    This is how my Texas Calc does the job, but when I got stuck into writing the code I found that this was a much more complex task than I had first envisaged.

    Most of my time is taken up with work, family and life, although I love to learn and attempt new things, therefore I just opted for a very simple (basic) calculator. Most of which was done during meal times at work.
    I like the idea of a competition because it allows others (including myself) to see the many different ways there are of approaching a problem. This can only help to improve ones understanding of the language and the 'tricks' of the trade.

    Please forgive my poor attempt at the competition but also understand that I only entered for fun and to show that I could also produce something that worked ;)
    I have a great deal of respect for everyone on this forum and would love to be able to code half as good as some of them :sign0188:

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice