How to make this in C programming language?

This is the game:
http://www.youtube.com/watch?v=_HsEBxSEn2M

I made stuff for showing the numbers but I can’t make that when you start subtracting, multiplying, etc.I insert the simbols and numbers with q=getchar() or q=getche() but there is so much stuff to do… Is there any other way?

✅ Answers

? Best Answer

  • Can you explain the game a little better? I don’t entirely feel I understand. Are the top two numbers, 34 and 18, the current score of each side? Or something else? Are the values 454, 4521, 20, and 1 provided to the players with the idea that each digit of 4521 must be used in an expression with 20 and 1 to yield 454? If so, why did one of the players put down a number that is 435? Or is it that they just enter an expression and the calculator does the calculation? If so, does the player ALSO get to see the results of the expression calculation? Or do they just have to hope they are right and do the calculations in their head? Are there any specific limitations to the expressions they can use? I see two multiplications, two subtractions, one addition, and one pair of parentheses. Is any such combination allowed? Or not?

    Other than that, such a program is actually quite easy to write. (Except that I’m not sure how two players would use the same program…. unless there was a client/server arrangement to handle it.)

    If you describe a little more what you are looking to achieve, so that I have a clear idea and am not just guessing, I’ll try and help.

    EDIT: example just posted to IDEONE link below:
    EDIT AGAIN: 2nd link below fixes a small bug, simplifies the floating point stack handling, and adds a lot of comments.

  • Leave a Comment