Current Specifications: The program works as expected. It will return answers to …show more content…
Both versions accept a string variable as the first argument. One of the versions accepts a string to be output to cout for the user to read before prompting the user for input. The input will be assigned to the string variable provided by the first argument. Paren returns a string of the contents of the innermost parentheses of the provided string (first argument). The integer variable provided in the second argument will be assigned the position of the opening parenthesis of the parentheses that is around the string returned by the function. The third argument is an integer and is assigned a vale to indicate the position of the closing …show more content…
Anything it doesn’t do is purely by design. I could add other mathematical functions, like sin, cos, tan, factorials, etc. I could also add something to assume when the user leaves a number next an opening parenthesis with no operator in between they mean the two should be multiplied. A white space stripper could also be added so white space could be used in the input without changing any of the rest of the program. I’m sure I could have improved the program. I’m sure I could condense the code down a bit or make it more easily read. I could have gone with a different overall motion to the program. It’s a bit similar to the iterative action of my program. It would likely end up nesting Calculate. When a parentheses is encounter a new instance of Calculate would be called up to deal with the contents of that one. Eventually the program would get down to the innermost parentheses and return that answer up a level so that instance can solve its