Calculator Challenge
Calculator Challenge
Are we suppose to implement a unary negatate operator "-" or just the binary form?
Edit: and i'm assuming we dont need any error handling? like verifying an ending ')' or such stuff?
Edit2: do we have to handle empty string without error?
Edit: and i'm assuming we dont need any error handling? like verifying an ending ')' or such stuff?
Edit2: do we have to handle empty string without error?
oh do we? so may I assume that the representation of 10+5 is "49,48,43,53"?MerickOWA wrote:We dont have the ability in hvm language to enter multidigit numbers no... but we still have to be able to support it in the calculator challenge. Example: "10+5" must print out 15 not 5 or 6lechat wrote:Do we have multi digit numbers?
-
- Posts: 60
- Joined: Fri Nov 07, 2008 10:43 am
- Location: Germany
I entered as solution
and got
Code: Select all
0<p
As you can see nested parentheses occur in some test cases. So, be prepared for them.Expected: '2', got: '49' for input '10/(2+3)'
Expected: '145', got: '49' for input '1*27+(23-26+18-6)*10+(13+15)'
Expected: '-368', got: '49' for input '16*3-22+8*12-27*18-4'
Expected: '470', got: '40' for input '(7+15+15-20+15+2*(19-16+14)*24-27*14)'
Expected: '-38104', got: '50' for input '22-15*4-5-10*28*17*8+12+1*7'
Expected: '303', got: '49' for input '11-2-8-13+25+2-((11-19)*3)*12'
'0<p' is incorrect.
-
- Posts: 60
- Joined: Fri Nov 07, 2008 10:43 am
- Location: Germany